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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if False: errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and len(d['unique_captures'])>1: errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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:
Continuation cloning duplicates a unique captured reference.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if False: errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not d['restored'] and bool(d['suspended']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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:
Continuation resumption restores only one suspended borrowed capability.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if False: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']+1: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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 resumed continuation uses its captured owner after storage expiry.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if False: errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])>2 and len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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:
Continuation argument lowering transfers one owned value twice.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if False: errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if len(set(d['outer_captures'])&set(d['released']))>1: errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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 nested handler releases a loan captured by an outer continuation.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if False: errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and len(d['frame_results'])>1: errors.append('unwind-frame-result')
    if not set(d['result_origins'])<=set(d['declared_returns']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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:
Unwinding preserves a continuation result borrowed from its destroyed frame.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if False: errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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(d):
    errors=[]
    if d['resume_count']>1: errors.append('one-shot-resume')
    if d['aborted'] and bool(d['capture_live']): errors.append('abort-capture-release')
    if d['escapes'] and bool(d['stack_captures']): errors.append('escape-capture-stack')
    if d['cloned'] and bool(d['unique_captures']): errors.append('clone-unique-capture')
    if not set(d['suspended'])<=set(d['restored']): errors.append('resume-loan-restore')
    if d['resumed_end']>d['owner_end']: errors.append('captured-owner-duration')
    if len(d['argument_transfers'])!=len(set(d['argument_transfers'])): errors.append('argument-transfer-once')
    if bool(set(d['outer_captures'])&set(d['released'])): errors.append('handler-capture-boundary')
    if d['unwound'] and bool(d['frame_results']): errors.append('unwind-frame-result')
    if not d['declared_returns'] and bool(d['result_origins']): errors.append('continuation-return-summary')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'resume_count': 0, 'aborted': False, 'capture_live': [], 'escapes': False, 'stack_captures': [], 'cloned': False, 'unique_captures': [], 'suspended': [], 'restored': [], 'owner_end': 0, 'resumed_end': 0, 'argument_transfers': [], 'outer_captures': [], 'released': [], 'unwound': False, 'frame_results': [], 'result_origins': [], 'declared_returns': []}
check('well formed empty obligations',solve(base),[])
check('one-shot-resume regression 0', solve(dict(base, **({'resume_count':2}))), ['one-shot-resume'])
check('one-shot-resume regression 1', solve(dict(base, **({'resume_count':2,'owner_end':N,'resumed_end':N}))), ['one-shot-resume'])
check('abort-capture-release regression 0', solve(dict(base, **({'aborted':True,'capture_live':['r']}))), ['abort-capture-release'])
check('abort-capture-release regression 1', solve(dict(base, **({'aborted':True,'capture_live':[N]}))), ['abort-capture-release'])
check('escape-capture-stack regression 0', solve(dict(base, **({'escapes':True,'stack_captures':['r']}))), ['escape-capture-stack'])
check('escape-capture-stack regression 1', solve(dict(base, **({'escapes':True,'stack_captures':[N]}))), ['escape-capture-stack'])
check('clone-unique-capture regression 0', solve(dict(base, **({'cloned':True,'unique_captures':['r']}))), ['clone-unique-capture'])
check('clone-unique-capture regression 1', solve(dict(base, **({'cloned':True,'unique_captures':[N]}))), ['clone-unique-capture'])
check('resume-loan-restore regression 0', solve(dict(base, **({'suspended':['a','b'],'restored':['a']}))), ['resume-loan-restore'])
check('resume-loan-restore regression 1', solve(dict(base, **({'suspended':[N,N+1],'restored':[N]}))), ['resume-loan-restore'])
check('captured-owner-duration regression 0', solve(dict(base, **({'resumed_end':N+1,'owner_end':N}))), ['captured-owner-duration'])
check('captured-owner-duration regression 1', solve(dict(base, **({'resumed_end':N+2,'owner_end':N+1}))), ['captured-owner-duration'])
check('argument-transfer-once regression 0', solve(dict(base, **({'argument_transfers':['x','x']}))), ['argument-transfer-once'])
check('argument-transfer-once regression 1', solve(dict(base, **({'argument_transfers':[N,N]}))), ['argument-transfer-once'])
check('handler-capture-boundary regression 0', solve(dict(base, **({'outer_captures':['r'],'released':['r']}))), ['handler-capture-boundary'])
check('handler-capture-boundary regression 1', solve(dict(base, **({'outer_captures':[N],'released':[N]}))), ['handler-capture-boundary'])
check('unwind-frame-result regression 0', solve(dict(base, **({'unwound':True,'frame_results':['r']}))), ['unwind-frame-result'])
check('unwind-frame-result regression 1', solve(dict(base, **({'unwound':True,'frame_results':[N]}))), ['unwind-frame-result'])
check('continuation-return-summary regression 0', solve(dict(base, **({'result_origins':['a','b'],'declared_returns':['a']}))), ['continuation-return-summary'])
check('continuation-return-summary regression 1', solve(dict(base, **({'result_origins':[N,N+1],'declared_returns':[N]}))), ['continuation-return-summary'])
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 continuation result escapes from an origin absent in its borrow summary.

Check a one-shot continuation calculus with borrowed captures. A continuation resumes at most once; abort releases captures; escaping continuation may not borrow its capturing stack; cloning continuation cannot duplicate unique captures; resumption restores suspended loans; captured owner must survive resumed body; continuation argument ownership is transferred once; nested handler cannot release outer captures; unwound continuation invalidates frame-local reference results; resumed result origin must be among the continuation declared return origins. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if False: errors.append('lifetime-arity')
    if d['expected_mapping']!=d['actual_mapping']: errors.append('positional-substitution')
    if any(len(set(xs))>1 for xs in d['occurrences'].values()): errors.append('repeated-substitution')
    if d['recursive_expected']!=d['recursive_actual']: errors.append('recursive-actual-map')
    if d['static_before']!=d['static_after']: errors.append('static-preservation')
    if len(d['anonymous_calls'])==len(d['anonymous_ids']) and len(set(d['anonymous_ids']))!=len(d['anonymous_ids']): errors.append('anonymous-freshness')
    if set(map(tuple,d['expected_outlives']))!=set(map(tuple,d['actual_outlives'])): errors.append('where-direction')
    if d['associated_args']!=d['recorded_args']: errors.append('associated-arguments')
    if d['accepted'] and bool(d['pending']): errors.append('summary-fixed-point')
    if not set(d['reference_types'])<=set(d['proof_metadata']): errors.append('erased-proof-metadata')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'params': [], 'args': [], 'expected_mapping': {}, 'actual_mapping': {}, 'occurrences': {}, 'recursive_expected': {}, 'recursive_actual': {}, 'static_before': None, 'static_after': None, 'anonymous_calls': [], 'anonymous_ids': [], 'expected_outlives': [], 'actual_outlives': [], 'associated_args': [], 'recorded_args': [], 'pending': [], 'accepted': False, 'reference_types': [], 'proof_metadata': []}
check('well formed empty obligations',solve(base),[])
check('lifetime-arity regression 0', solve(dict(base, **({'params':['a'],'args':['x','y']}))), ['lifetime-arity'])
check('lifetime-arity regression 1', solve(dict(base, **({'params':[N],'args':[N,N+1]}))), ['lifetime-arity'])
check('positional-substitution regression 0', solve(dict(base, **({'expected_mapping':{'a':'x','b':'y'},'actual_mapping':{'a':'y','b':'x'}}))), ['positional-substitution'])
check('positional-substitution regression 1', solve(dict(base, **({'expected_mapping':{'a':N,'b':N+1},'actual_mapping':{'a':N+1,'b':N}}))), ['positional-substitution'])
check('repeated-substitution regression 0', solve(dict(base, **({'occurrences':{'a':['x','y']}}))), ['repeated-substitution'])
check('repeated-substitution regression 1', solve(dict(base, **({'occurrences':{'a':[N,N+1]}}))), ['repeated-substitution'])
check('recursive-actual-map regression 0', solve(dict(base, **({'recursive_expected':{'call':'b'},'recursive_actual':{'call':'a'}}))), ['recursive-actual-map'])
check('recursive-actual-map regression 1', solve(dict(base, **({'recursive_expected':{'call':N+1},'recursive_actual':{'call':N}}))), ['recursive-actual-map'])
check('static-preservation regression 0', solve(dict(base, **({'static_before':'static','static_after':'a'}))), ['static-preservation'])
check('static-preservation regression 1', solve(dict(base, **({'static_before':'static','static_after':N}))), ['static-preservation'])
check('anonymous-freshness regression 0', solve(dict(base, **({'anonymous_calls':['c1','c2'],'anonymous_ids':['r','r']}))), ['anonymous-freshness'])
check('anonymous-freshness regression 1', solve(dict(base, **({'anonymous_calls':[N,N+1],'anonymous_ids':[0,0]}))), ['anonymous-freshness'])
check('where-direction regression 0', solve(dict(base, **({'expected_outlives':[('a','b')],'actual_outlives':[('b','a')]}))), ['where-direction'])
check('where-direction regression 1', solve(dict(base, **({'expected_outlives':[(N,N+1)],'actual_outlives':[(N+1,N)]}))), ['where-direction'])
check('associated-arguments regression 0', solve(dict(base, **({'associated_args':['a','b'],'recorded_args':['b','a']}))), ['associated-arguments'])
check('associated-arguments regression 1', solve(dict(base, **({'associated_args':[N,N+1],'recorded_args':[N+1,N]}))), ['associated-arguments'])
check('summary-fixed-point regression 0', solve(dict(base, **({'accepted':True,'pending':['a']}))), ['summary-fixed-point'])
check('summary-fixed-point regression 1', solve(dict(base, **({'accepted':True,'pending':[N]}))), ['summary-fixed-point'])
check('erased-proof-metadata regression 0', solve(dict(base, **({'reference_types':['a','b'],'proof_metadata':['a']}))), ['erased-proof-metadata'])
check('erased-proof-metadata regression 1', solve(dict(base, **({'reference_types':[N,N+1],'proof_metadata':[N]}))), ['erased-proof-metadata'])
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(d):
    errors=[]
    if len(d['params'])>len(d['args']): errors.append('lifetime-arity')
    if d['expected_mapping']!=d['actual_mapping']: errors.append('positional-substitution')
    if any(len(set(xs))>1 for xs in d['occurrences'].values()): errors.append('repeated-substitution')
    if d['recursive_expected']!=d['recursive_actual']: errors.append('recursive-actual-map')
    if d['static_before']!=d['static_after']: errors.append('static-preservation')
    if len(d['anonymous_calls'])==len(d['anonymous_ids']) and len(set(d['anonymous_ids']))!=len(d['anonymous_ids']): errors.append('anonymous-freshness')
    if set(map(tuple,d['expected_outlives']))!=set(map(tuple,d['actual_outlives'])): errors.append('where-direction')
    if d['associated_args']!=d['recorded_args']: errors.append('associated-arguments')
    if d['accepted'] and bool(d['pending']): errors.append('summary-fixed-point')
    if not set(d['reference_types'])<=set(d['proof_metadata']): errors.append('erased-proof-metadata')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'params': [], 'args': [], 'expected_mapping': {}, 'actual_mapping': {}, 'occurrences': {}, 'recursive_expected': {}, 'recursive_actual': {}, 'static_before': None, 'static_after': None, 'anonymous_calls': [], 'anonymous_ids': [], 'expected_outlives': [], 'actual_outlives': [], 'associated_args': [], 'recorded_args': [], 'pending': [], 'accepted': False, 'reference_types': [], 'proof_metadata': []}
check('well formed empty obligations',solve(base),[])
check('lifetime-arity regression 0', solve(dict(base, **({'params':['a'],'args':['x','y']}))), ['lifetime-arity'])
check('lifetime-arity regression 1', solve(dict(base, **({'params':[N],'args':[N,N+1]}))), ['lifetime-arity'])
check('positional-substitution regression 0', solve(dict(base, **({'expected_mapping':{'a':'x','b':'y'},'actual_mapping':{'a':'y','b':'x'}}))), ['positional-substitution'])
check('positional-substitution regression 1', solve(dict(base, **({'expected_mapping':{'a':N,'b':N+1},'actual_mapping':{'a':N+1,'b':N}}))), ['positional-substitution'])
check('repeated-substitution regression 0', solve(dict(base, **({'occurrences':{'a':['x','y']}}))), ['repeated-substitution'])
check('repeated-substitution regression 1', solve(dict(base, **({'occurrences':{'a':[N,N+1]}}))), ['repeated-substitution'])
check('recursive-actual-map regression 0', solve(dict(base, **({'recursive_expected':{'call':'b'},'recursive_actual':{'call':'a'}}))), ['recursive-actual-map'])
check('recursive-actual-map regression 1', solve(dict(base, **({'recursive_expected':{'call':N+1},'recursive_actual':{'call':N}}))), ['recursive-actual-map'])
check('static-preservation regression 0', solve(dict(base, **({'static_before':'static','static_after':'a'}))), ['static-preservation'])
check('static-preservation regression 1', solve(dict(base, **({'static_before':'static','static_after':N}))), ['static-preservation'])
check('anonymous-freshness regression 0', solve(dict(base, **({'anonymous_calls':['c1','c2'],'anonymous_ids':['r','r']}))), ['anonymous-freshness'])
check('anonymous-freshness regression 1', solve(dict(base, **({'anonymous_calls':[N,N+1],'anonymous_ids':[0,0]}))), ['anonymous-freshness'])
check('where-direction regression 0', solve(dict(base, **({'expected_outlives':[('a','b')],'actual_outlives':[('b','a')]}))), ['where-direction'])
check('where-direction regression 1', solve(dict(base, **({'expected_outlives':[(N,N+1)],'actual_outlives':[(N+1,N)]}))), ['where-direction'])
check('associated-arguments regression 0', solve(dict(base, **({'associated_args':['a','b'],'recorded_args':['b','a']}))), ['associated-arguments'])
check('associated-arguments regression 1', solve(dict(base, **({'associated_args':[N,N+1],'recorded_args':[N+1,N]}))), ['associated-arguments'])
check('summary-fixed-point regression 0', solve(dict(base, **({'accepted':True,'pending':['a']}))), ['summary-fixed-point'])
check('summary-fixed-point regression 1', solve(dict(base, **({'accepted':True,'pending':[N]}))), ['summary-fixed-point'])
check('erased-proof-metadata regression 0', solve(dict(base, **({'reference_types':['a','b'],'proof_metadata':['a']}))), ['erased-proof-metadata'])
check('erased-proof-metadata regression 1', solve(dict(base, **({'reference_types':[N,N+1],'proof_metadata':[N]}))), ['erased-proof-metadata'])
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:
Generic instantiation silently ignores excess lifetime arguments.

Check generic borrow-summary instantiation. Generic lifetime arguments match parameter arity; parameter substitution is positional; repeated occurrences substitute consistently; recursive instantiation uses each callee actual mapping; static lifetime is not substituted; inferred anonymous lifetimes are fresh per call; where-outlives obligations instantiated in declared direction; associated lifetime applications include all type arguments; recursive summary fixed point cannot be accepted while new obligations remain; monomorphized reference types retain lifetime proof metadata. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['params'])!=len(d['args']): errors.append('lifetime-arity')
    if False: errors.append('positional-substitution')
    if any(len(set(xs))>1 for xs in d['occurrences'].values()): errors.append('repeated-substitution')
    if d['recursive_expected']!=d['recursive_actual']: errors.append('recursive-actual-map')
    if d['static_before']!=d['static_after']: errors.append('static-preservation')
    if len(d['anonymous_calls'])==len(d['anonymous_ids']) and len(set(d['anonymous_ids']))!=len(d['anonymous_ids']): errors.append('anonymous-freshness')
    if set(map(tuple,d['expected_outlives']))!=set(map(tuple,d['actual_outlives'])): errors.append('where-direction')
    if d['associated_args']!=d['recorded_args']: errors.append('associated-arguments')
    if d['accepted'] and bool(d['pending']): errors.append('summary-fixed-point')
    if not set(d['reference_types'])<=set(d['proof_metadata']): errors.append('erased-proof-metadata')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'params': [], 'args': [], 'expected_mapping': {}, 'actual_mapping': {}, 'occurrences': {}, 'recursive_expected': {}, 'recursive_actual': {}, 'static_before': None, 'static_after': None, 'anonymous_calls': [], 'anonymous_ids': [], 'expected_outlives': [], 'actual_outlives': [], 'associated_args': [], 'recorded_args': [], 'pending': [], 'accepted': False, 'reference_types': [], 'proof_metadata': []}
check('well formed empty obligations',solve(base),[])
check('lifetime-arity regression 0', solve(dict(base, **({'params':['a'],'args':['x','y']}))), ['lifetime-arity'])
check('lifetime-arity regression 1', solve(dict(base, **({'params':[N],'args':[N,N+1]}))), ['lifetime-arity'])
check('positional-substitution regression 0', solve(dict(base, **({'expected_mapping':{'a':'x','b':'y'},'actual_mapping':{'a':'y','b':'x'}}))), ['positional-substitution'])
check('positional-substitution regression 1', solve(dict(base, **({'expected_mapping':{'a':N,'b':N+1},'actual_mapping':{'a':N+1,'b':N}}))), ['positional-substitution'])
check('repeated-substitution regression 0', solve(dict(base, **({'occurrences':{'a':['x','y']}}))), ['repeated-substitution'])
check('repeated-substitution regression 1', solve(dict(base, **({'occurrences':{'a':[N,N+1]}}))), ['repeated-substitution'])
check('recursive-actual-map regression 0', solve(dict(base, **({'recursive_expected':{'call':'b'},'recursive_actual':{'call':'a'}}))), ['recursive-actual-map'])
check('recursive-actual-map regression 1', solve(dict(base, **({'recursive_expected':{'call':N+1},'recursive_actual':{'call':N}}))), ['recursive-actual-map'])
check('static-preservation regression 0', solve(dict(base, **({'static_before':'static','static_after':'a'}))), ['static-preservation'])
check('static-preservation regression 1', solve(dict(base, **({'static_before':'static','static_after':N}))), ['static-preservation'])
check('anonymous-freshness regression 0', solve(dict(base, **({'anonymous_calls':['c1','c2'],'anonymous_ids':['r','r']}))), ['anonymous-freshness'])
check('anonymous-freshness regression 1', solve(dict(base, **({'anonymous_calls':[N,N+1],'anonymous_ids':[0,0]}))), ['anonymous-freshness'])
check('where-direction regression 0', solve(dict(base, **({'expected_outlives':[('a','b')],'actual_outlives':[('b','a')]}))), ['where-direction'])
check('where-direction regression 1', solve(dict(base, **({'expected_outlives':[(N,N+1)],'actual_outlives':[(N+1,N)]}))), ['where-direction'])
check('associated-arguments regression 0', solve(dict(base, **({'associated_args':['a','b'],'recorded_args':['b','a']}))), ['associated-arguments'])
check('associated-arguments regression 1', solve(dict(base, **({'associated_args':[N,N+1],'recorded_args':[N+1,N]}))), ['associated-arguments'])
check('summary-fixed-point regression 0', solve(dict(base, **({'accepted':True,'pending':['a']}))), ['summary-fixed-point'])
check('summary-fixed-point regression 1', solve(dict(base, **({'accepted':True,'pending':[N]}))), ['summary-fixed-point'])
check('erased-proof-metadata regression 0', solve(dict(base, **({'reference_types':['a','b'],'proof_metadata':['a']}))), ['erased-proof-metadata'])
check('erased-proof-metadata regression 1', solve(dict(base, **({'reference_types':[N,N+1],'proof_metadata':[N]}))), ['erased-proof-metadata'])
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(d):
    errors=[]
    if len(d['params'])!=len(d['args']): errors.append('lifetime-arity')
    if set(d['expected_mapping'])!=set(d['actual_mapping']): errors.append('positional-substitution')
    if any(len(set(xs))>1 for xs in d['occurrences'].values()): errors.append('repeated-substitution')
    if d['recursive_expected']!=d['recursive_actual']: errors.append('recursive-actual-map')
    if d['static_before']!=d['static_after']: errors.append('static-preservation')
    if len(d['anonymous_calls'])==len(d['anonymous_ids']) and len(set(d['anonymous_ids']))!=len(d['anonymous_ids']): errors.append('anonymous-freshness')
    if set(map(tuple,d['expected_outlives']))!=set(map(tuple,d['actual_outlives'])): errors.append('where-direction')
    if d['associated_args']!=d['recorded_args']: errors.append('associated-arguments')
    if d['accepted'] and bool(d['pending']): errors.append('summary-fixed-point')
    if not set(d['reference_types'])<=set(d['proof_metadata']): errors.append('erased-proof-metadata')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'params': [], 'args': [], 'expected_mapping': {}, 'actual_mapping': {}, 'occurrences': {}, 'recursive_expected': {}, 'recursive_actual': {}, 'static_before': None, 'static_after': None, 'anonymous_calls': [], 'anonymous_ids': [], 'expected_outlives': [], 'actual_outlives': [], 'associated_args': [], 'recorded_args': [], 'pending': [], 'accepted': False, 'reference_types': [], 'proof_metadata': []}
check('well formed empty obligations',solve(base),[])
check('lifetime-arity regression 0', solve(dict(base, **({'params':['a'],'args':['x','y']}))), ['lifetime-arity'])
check('lifetime-arity regression 1', solve(dict(base, **({'params':[N],'args':[N,N+1]}))), ['lifetime-arity'])
check('positional-substitution regression 0', solve(dict(base, **({'expected_mapping':{'a':'x','b':'y'},'actual_mapping':{'a':'y','b':'x'}}))), ['positional-substitution'])
check('positional-substitution regression 1', solve(dict(base, **({'expected_mapping':{'a':N,'b':N+1},'actual_mapping':{'a':N+1,'b':N}}))), ['positional-substitution'])
check('repeated-substitution regression 0', solve(dict(base, **({'occurrences':{'a':['x','y']}}))), ['repeated-substitution'])
check('repeated-substitution regression 1', solve(dict(base, **({'occurrences':{'a':[N,N+1]}}))), ['repeated-substitution'])
check('recursive-actual-map regression 0', solve(dict(base, **({'recursive_expected':{'call':'b'},'recursive_actual':{'call':'a'}}))), ['recursive-actual-map'])
check('recursive-actual-map regression 1', solve(dict(base, **({'recursive_expected':{'call':N+1},'recursive_actual':{'call':N}}))), ['recursive-actual-map'])
check('static-preservation regression 0', solve(dict(base, **({'static_before':'static','static_after':'a'}))), ['static-preservation'])
check('static-preservation regression 1', solve(dict(base, **({'static_before':'static','static_after':N}))), ['static-preservation'])
check('anonymous-freshness regression 0', solve(dict(base, **({'anonymous_calls':['c1','c2'],'anonymous_ids':['r','r']}))), ['anonymous-freshness'])
check('anonymous-freshness regression 1', solve(dict(base, **({'anonymous_calls':[N,N+1],'anonymous_ids':[0,0]}))), ['anonymous-freshness'])
check('where-direction regression 0', solve(dict(base, **({'expected_outlives':[('a','b')],'actual_outlives':[('b','a')]}))), ['where-direction'])
check('where-direction regression 1', solve(dict(base, **({'expected_outlives':[(N,N+1)],'actual_outlives':[(N+1,N)]}))), ['where-direction'])
check('associated-arguments regression 0', solve(dict(base, **({'associated_args':['a','b'],'recorded_args':['b','a']}))), ['associated-arguments'])
check('associated-arguments regression 1', solve(dict(base, **({'associated_args':[N,N+1],'recorded_args':[N+1,N]}))), ['associated-arguments'])
check('summary-fixed-point regression 0', solve(dict(base, **({'accepted':True,'pending':['a']}))), ['summary-fixed-point'])
check('summary-fixed-point regression 1', solve(dict(base, **({'accepted':True,'pending':[N]}))), ['summary-fixed-point'])
check('erased-proof-metadata regression 0', solve(dict(base, **({'reference_types':['a','b'],'proof_metadata':['a']}))), ['erased-proof-metadata'])
check('erased-proof-metadata regression 1', solve(dict(base, **({'reference_types':[N,N+1],'proof_metadata':[N]}))), ['erased-proof-metadata'])
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:
Generic lifetime arguments are substituted into the wrong parameter positions.

Check generic borrow-summary instantiation. Generic lifetime arguments match parameter arity; parameter substitution is positional; repeated occurrences substitute consistently; recursive instantiation uses each callee actual mapping; static lifetime is not substituted; inferred anonymous lifetimes are fresh per call; where-outlives obligations instantiated in declared direction; associated lifetime applications include all type arguments; recursive summary fixed point cannot be accepted while new obligations remain; monomorphized reference types retain lifetime proof metadata. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access