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

N = 1
observations = []
def solve(d):
    errors=[]
    if False: errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and not set(d['after_owned'])<=set(d['pre_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A failed guard leaves its speculative ownership move committed.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if False: errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not d['copyable'] and bool(d['guard_moves']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A guard consumes a noncopy place needed by later pattern alternatives.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if False: errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if len(set(d['arm_local'])&set(d['next_arm_live']))>1: errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A failed match arm leaks a local loan into the next arm.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if False: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan'] and d['guard_failed']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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:
Guard mutation invalidates the variant witness of a borrowed payload.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if False: errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and len(d['committed_moves'])>1: errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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:
Pattern move is committed before guard acceptance.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if False: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique'] and d['projected_loan']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A pure pattern test unnecessarily acquires an exclusive scrutinee loan.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if False: errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not d['joined'] and bool(d['arms']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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:
Postmatch ownership state omits a reachable arm.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if False: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included'] and not d['arms']: errors.append('fallback-state')
    if bool(set(d['guard_temps'])&set(d['failed_guard_live'])): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A nonexhaustive guarded match omits the no-arm-taken ownership state.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if False: errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
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['guard_failed'] and set(d['pre_owned'])!=set(d['after_owned']): errors.append('failed-guard-restore')
    if not set(d['guard_moves'])<=set(d['copyable']): errors.append('guard-move')
    if bool(set(d['arm_local'])&set(d['next_arm_live'])): errors.append('arm-local-end')
    if d['discriminant_mutated'] and d['projected_loan']: errors.append('discriminant-stability')
    if not d['guard_succeeded'] and bool(d['committed_moves']): errors.append('move-commit-point')
    if d['test_unique']: errors.append('pattern-test-capability')
    if not set(d['arms'])<=set(d['joined']): errors.append('reachable-arm-join')
    if not d['exhaustive'] and not d['fallback_included']: errors.append('fallback-state')
    if set(d['guard_temps'])==set(d['failed_guard_live']) and bool(d['guard_temps']): errors.append('failed-guard-temporaries')
    if d['binding_end']<d['guard_end']: errors.append('binding-guard-duration')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'guard_failed': False, 'pre_owned': [], 'after_owned': [], 'guard_moves': [], 'copyable': [], 'arm_local': [], 'next_arm_live': [], 'discriminant_mutated': False, 'projected_loan': False, 'guard_succeeded': True, 'committed_moves': [], 'test_unique': False, 'arms': [], 'joined': [], 'exhaustive': True, 'fallback_included': True, 'guard_temps': [], 'failed_guard_live': [], 'guard_end': 0, 'binding_end': 0}
check('well formed empty obligations',solve(base),[])
check('failed-guard-restore regression 0', solve(dict(base, **({'guard_failed':True,'pre_owned':['x']}))), ['failed-guard-restore'])
check('failed-guard-restore regression 1', solve(dict(base, **({'guard_failed':True,'pre_owned':[N],'after_owned':[]}))), ['failed-guard-restore'])
check('guard-move regression 0', solve(dict(base, **({'guard_moves':['a','b'],'copyable':['a']}))), ['guard-move'])
check('guard-move regression 1', solve(dict(base, **({'guard_moves':[N,N+1],'copyable':[N]}))), ['guard-move'])
check('arm-local-end regression 0', solve(dict(base, **({'arm_local':['r'],'next_arm_live':['r']}))), ['arm-local-end'])
check('arm-local-end regression 1', solve(dict(base, **({'arm_local':[N],'next_arm_live':[N]}))), ['arm-local-end'])
check('discriminant-stability regression 0', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True}))), ['discriminant-stability'])
check('discriminant-stability regression 1', solve(dict(base, **({'discriminant_mutated':True,'projected_loan':True,'guard_end':N,'binding_end':N}))), ['discriminant-stability'])
check('move-commit-point regression 0', solve(dict(base, **({'guard_succeeded':False,'committed_moves':['x']}))), ['move-commit-point'])
check('move-commit-point regression 1', solve(dict(base, **({'guard_succeeded':False,'committed_moves':[N]}))), ['move-commit-point'])
check('pattern-test-capability regression 0', solve(dict(base, **({'test_unique':True}))), ['pattern-test-capability'])
check('pattern-test-capability regression 1', solve(dict(base, **({'test_unique':True,'guard_end':N,'binding_end':N}))), ['pattern-test-capability'])
check('reachable-arm-join regression 0', solve(dict(base, **({'arms':['a','b'],'joined':['a']}))), ['reachable-arm-join'])
check('reachable-arm-join regression 1', solve(dict(base, **({'arms':list(range(N+1)),'joined':[0]}))), ['reachable-arm-join'])
check('fallback-state regression 0', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':['a'],'joined':['a']}))), ['fallback-state'])
check('fallback-state regression 1', solve(dict(base, **({'exhaustive':False,'fallback_included':False,'arms':[N],'joined':[N]}))), ['fallback-state'])
check('failed-guard-temporaries regression 0', solve(dict(base, **({'guard_temps':['a','b'],'failed_guard_live':['b']}))), ['failed-guard-temporaries'])
check('failed-guard-temporaries regression 1', solve(dict(base, **({'guard_temps':[N,N+1],'failed_guard_live':[N]}))), ['failed-guard-temporaries'])
check('binding-guard-duration regression 0', solve(dict(base, **({'guard_end':N+1,'binding_end':N}))), ['binding-guard-duration'])
check('binding-guard-duration regression 1', solve(dict(base, **({'guard_end':N+2,'binding_end':N+1}))), ['binding-guard-duration'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A failed guard retains one temporary borrow into subsequent matching.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. 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