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

N = 1
observations = []
def solve(d):
    errors=[]
    if False: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']+1<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
For-loop desugaring drops its borrowed iterator before loop completion.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if False: errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and len(d['body_loans_live'])>1: errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Question-mark early return retains a body-local borrow.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if False: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled'] and d['error_exit']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Short-circuit lowering unconditionally creates the right operand borrow.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if False: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place'][:1]!=d['autoref_place'][:1]: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Method autoref borrows the pointer container instead of the resolved receiver place.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if False: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']==0: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Compound assignment evaluates a borrowing destination expression twice.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if False: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']+1: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Index lowering reorders index-side mutation before the base borrow.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if False: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']+1<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Await desugaring drops the future owner before its final resume.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if False: errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and len(set(d['success_bindings'])&set(d['else_uses']))>1: errors.append('let-else-binding-scope')
    if d['first_write']<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Let-else failure branch can use a borrowed binding created only on success.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if False: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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['iterator_end']<d['loop_end']: errors.append('for-owner-duration')
    if d['error_exit'] and bool(d['body_loans_live']): errors.append('question-error-cleanup')
    if d['rhs_evaluated'] and not d['rhs_enabled']: errors.append('short-circuit-conditional')
    if d['autoderef_place']!=d['autoref_place']: errors.append('autoref-after-autoderef')
    if d['compound_assignment'] and d['destination_evaluations']!=1: errors.append('compound-destination-once')
    if d['base_point']>d['index_point']: errors.append('index-evaluation-order')
    if d['future_owner_end']<d['await_resume']: errors.append('await-future-owner')
    if d['else_branch'] and bool(set(d['success_bindings'])&set(d['else_uses'])): errors.append('let-else-binding-scope')
    if d['first_write']+1<d['rhs_end']: errors.append('destructure-stage-rhs')
    if d['return_check']>d['cleanup_point']: errors.append('return-before-cleanup')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'iterator_end': 0, 'loop_end': 0, 'error_exit': False, 'body_loans_live': [], 'rhs_evaluated': False, 'rhs_enabled': True, 'autoderef_place': [], 'autoref_place': [], 'destination_evaluations': 0, 'compound_assignment': False, 'base_point': 0, 'index_point': 0, 'future_owner_end': 0, 'await_resume': 0, 'else_branch': False, 'success_bindings': [], 'else_uses': [], 'rhs_end': 0, 'first_write': 0, 'return_check': 0, 'cleanup_point': 0}
check('well formed empty obligations',solve(base),[])
check('for-owner-duration regression 0', solve(dict(base, **({'iterator_end':N,'loop_end':N+1}))), ['for-owner-duration'])
check('for-owner-duration regression 1', solve(dict(base, **({'iterator_end':N+1,'loop_end':N+2}))), ['for-owner-duration'])
check('question-error-cleanup regression 0', solve(dict(base, **({'error_exit':True,'body_loans_live':['r']}))), ['question-error-cleanup'])
check('question-error-cleanup regression 1', solve(dict(base, **({'error_exit':True,'body_loans_live':[N]}))), ['question-error-cleanup'])
check('short-circuit-conditional regression 0', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False}))), ['short-circuit-conditional'])
check('short-circuit-conditional regression 1', solve(dict(base, **({'rhs_evaluated':True,'rhs_enabled':False,'loop_end':N,'iterator_end':N}))), ['short-circuit-conditional'])
check('autoref-after-autoderef regression 0', solve(dict(base, **({'autoderef_place':['r','*'],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('autoref-after-autoderef regression 1', solve(dict(base, **({'autoderef_place':['r','*',N],'autoref_place':['r']}))), ['autoref-after-autoderef'])
check('compound-destination-once regression 0', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':2}))), ['compound-destination-once'])
check('compound-destination-once regression 1', solve(dict(base, **({'compound_assignment':True,'destination_evaluations':N+2}))), ['compound-destination-once'])
check('index-evaluation-order regression 0', solve(dict(base, **({'base_point':N+1,'index_point':N}))), ['index-evaluation-order'])
check('index-evaluation-order regression 1', solve(dict(base, **({'base_point':N+2,'index_point':N+1}))), ['index-evaluation-order'])
check('await-future-owner regression 0', solve(dict(base, **({'future_owner_end':N,'await_resume':N+1}))), ['await-future-owner'])
check('await-future-owner regression 1', solve(dict(base, **({'future_owner_end':N+1,'await_resume':N+2}))), ['await-future-owner'])
check('let-else-binding-scope regression 0', solve(dict(base, **({'else_branch':True,'success_bindings':['x'],'else_uses':['x']}))), ['let-else-binding-scope'])
check('let-else-binding-scope regression 1', solve(dict(base, **({'else_branch':True,'success_bindings':[N],'else_uses':[N]}))), ['let-else-binding-scope'])
check('destructure-stage-rhs regression 0', solve(dict(base, **({'first_write':N,'rhs_end':N+1}))), ['destructure-stage-rhs'])
check('destructure-stage-rhs regression 1', solve(dict(base, **({'first_write':N+1,'rhs_end':N+2}))), ['destructure-stage-rhs'])
check('return-before-cleanup regression 0', solve(dict(base, **({'return_check':N+1,'cleanup_point':N}))), ['return-before-cleanup'])
check('return-before-cleanup regression 1', solve(dict(base, **({'return_check':N+2,'cleanup_point':N+1}))), ['return-before-cleanup'])
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:
Destructuring assignment overwrites an owner before RHS borrow evaluation completes.

Validate borrow-sensitive desugaring proof facts. For-loop iterator temporary covers loop; question-mark error exit drops body loans; short-circuit right operand is conditionally evaluated; method autoref targets receiver after autoderef; compound assignment evaluates destination once; indexing evaluates base before index; await suspension preserves the borrowed future owner; let-else failure cannot access successful bindings; destructuring assignment stages RHS borrows before writing destinations; return expression lifetime is checked before local cleanup. 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