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

N = 1
observations = []
def solve(d):
    errors=[]
    if not set(d['live_origins'])<=set(d['frame_slots']): errors.append('frame-promotion')
    if d['movable'] and bool(d['self_refs']): errors.append('self-move')
    if not set(d['self_refs'])<=set(d['pinned']): errors.append('pin-projection')
    if bool(set(d['unique_saved'])&set(d['external_aliases'])): errors.append('suspended-unique-alias')
    if bool(set(d['guards'])&set(d['suspend_disallowed'])): errors.append('guard-yield')
    if not set(d['resume'])<=set(d['valid']): errors.append('resume-lifetime')
    if any(d['drop_order'].index(b)>d['drop_order'].index(o) for b,o in d['dependencies']): errors.append('cancel-drop-order')
    if d['completed'] and bool(set(d['returned'])&set(d['frame_slots'])): errors.append('completed-frame-return')
    if bool(set(d['saved'])&set(d['killed'])): errors.append('dead-loan-spill')
    if False: errors.append('variant-separation')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'live_origins': [], 'frame_slots': [], 'self_refs': [], 'movable': False, 'pinned': [], 'unique_saved': [], 'external_aliases': [], 'guards': [], 'suspend_disallowed': [], 'resume': [], 'valid': [], 'drop_order': [], 'dependencies': [], 'returned': [], 'completed': False, 'saved': [], 'killed': [], 'variant_loans': {}, 'active_variant': None, 'common_loans': []}
check('well formed empty obligations',solve(base),[])
check('frame-promotion regression 0', solve(dict(base, **({'live_origins':['a','b'],'frame_slots':['a']}))), ['frame-promotion'])
check('frame-promotion regression 1', solve(dict(base, **({'live_origins':['a',N],'frame_slots':['a']}))), ['frame-promotion'])
check('self-move regression 0', solve(dict(base, **({'movable':True,'self_refs':['r'],'pinned':['r']}))), ['self-move'])
check('self-move regression 1', solve(dict(base, **({'movable':True,'self_refs':[N],'pinned':[N]}))), ['self-move'])
check('pin-projection regression 0', solve(dict(base, **({'self_refs':['a','b'],'pinned':['a']}))), ['pin-projection'])
check('pin-projection regression 1', solve(dict(base, **({'self_refs':[N],'pinned':[N+1]}))), ['pin-projection'])
check('suspended-unique-alias regression 0', solve(dict(base, **({'unique_saved':['a'],'external_aliases':['a']}))), ['suspended-unique-alias'])
check('suspended-unique-alias regression 1', solve(dict(base, **({'unique_saved':[N],'external_aliases':[N]}))), ['suspended-unique-alias'])
check('guard-yield regression 0', solve(dict(base, **({'guards':['a','b'],'suspend_disallowed':['b']}))), ['guard-yield'])
check('guard-yield regression 1', solve(dict(base, **({'guards':['a',N],'suspend_disallowed':[N]}))), ['guard-yield'])
check('resume-lifetime regression 0', solve(dict(base, **({'resume':[N],'valid':[N+1]}))), ['resume-lifetime'])
check('resume-lifetime regression 1', solve(dict(base, **({'resume':[N,N+1],'valid':[N+1,N+2]}))), ['resume-lifetime'])
check('cancel-drop-order regression 0', solve(dict(base, **({'drop_order':['o','b'],'dependencies':[('b','o')]}))), ['cancel-drop-order'])
check('cancel-drop-order regression 1', solve(dict(base, **({'drop_order':['x','o','b'],'dependencies':[('b','o')]}))), ['cancel-drop-order'])
check('completed-frame-return regression 0', solve(dict(base, **({'completed':True,'returned':['x','r'],'frame_slots':['r']}))), ['completed-frame-return'])
check('completed-frame-return regression 1', solve(dict(base, **({'completed':True,'returned':['x',N],'frame_slots':[N]}))), ['completed-frame-return'])
check('dead-loan-spill regression 0', solve(dict(base, **({'saved':['a','b'],'killed':['b']}))), ['dead-loan-spill'])
check('dead-loan-spill regression 1', solve(dict(base, **({'saved':[N,N+1],'killed':[N+1]}))), ['dead-loan-spill'])
check('variant-separation regression 0', solve(dict(base, **({'active_variant':'a','variant_loans':{'b':['r']},'common_loans':['r']}))), ['variant-separation'])
check('variant-separation regression 1', solve(dict(base, **({'active_variant':N,'variant_loans':{N+1:['r']},'common_loans':['r']}))), ['variant-separation'])
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 not set(d['live_origins'])<=set(d['frame_slots']): errors.append('frame-promotion')
    if d['movable'] and bool(d['self_refs']): errors.append('self-move')
    if not set(d['self_refs'])<=set(d['pinned']): errors.append('pin-projection')
    if bool(set(d['unique_saved'])&set(d['external_aliases'])): errors.append('suspended-unique-alias')
    if bool(set(d['guards'])&set(d['suspend_disallowed'])): errors.append('guard-yield')
    if not set(d['resume'])<=set(d['valid']): errors.append('resume-lifetime')
    if any(d['drop_order'].index(b)>d['drop_order'].index(o) for b,o in d['dependencies']): errors.append('cancel-drop-order')
    if d['completed'] and bool(set(d['returned'])&set(d['frame_slots'])): errors.append('completed-frame-return')
    if bool(set(d['saved'])&set(d['killed'])): errors.append('dead-loan-spill')
    if any(v!=d['active_variant'] and len(set(ls)&set(d['common_loans']))>1 for v,ls in d['variant_loans'].items()): errors.append('variant-separation')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'live_origins': [], 'frame_slots': [], 'self_refs': [], 'movable': False, 'pinned': [], 'unique_saved': [], 'external_aliases': [], 'guards': [], 'suspend_disallowed': [], 'resume': [], 'valid': [], 'drop_order': [], 'dependencies': [], 'returned': [], 'completed': False, 'saved': [], 'killed': [], 'variant_loans': {}, 'active_variant': None, 'common_loans': []}
check('well formed empty obligations',solve(base),[])
check('frame-promotion regression 0', solve(dict(base, **({'live_origins':['a','b'],'frame_slots':['a']}))), ['frame-promotion'])
check('frame-promotion regression 1', solve(dict(base, **({'live_origins':['a',N],'frame_slots':['a']}))), ['frame-promotion'])
check('self-move regression 0', solve(dict(base, **({'movable':True,'self_refs':['r'],'pinned':['r']}))), ['self-move'])
check('self-move regression 1', solve(dict(base, **({'movable':True,'self_refs':[N],'pinned':[N]}))), ['self-move'])
check('pin-projection regression 0', solve(dict(base, **({'self_refs':['a','b'],'pinned':['a']}))), ['pin-projection'])
check('pin-projection regression 1', solve(dict(base, **({'self_refs':[N],'pinned':[N+1]}))), ['pin-projection'])
check('suspended-unique-alias regression 0', solve(dict(base, **({'unique_saved':['a'],'external_aliases':['a']}))), ['suspended-unique-alias'])
check('suspended-unique-alias regression 1', solve(dict(base, **({'unique_saved':[N],'external_aliases':[N]}))), ['suspended-unique-alias'])
check('guard-yield regression 0', solve(dict(base, **({'guards':['a','b'],'suspend_disallowed':['b']}))), ['guard-yield'])
check('guard-yield regression 1', solve(dict(base, **({'guards':['a',N],'suspend_disallowed':[N]}))), ['guard-yield'])
check('resume-lifetime regression 0', solve(dict(base, **({'resume':[N],'valid':[N+1]}))), ['resume-lifetime'])
check('resume-lifetime regression 1', solve(dict(base, **({'resume':[N,N+1],'valid':[N+1,N+2]}))), ['resume-lifetime'])
check('cancel-drop-order regression 0', solve(dict(base, **({'drop_order':['o','b'],'dependencies':[('b','o')]}))), ['cancel-drop-order'])
check('cancel-drop-order regression 1', solve(dict(base, **({'drop_order':['x','o','b'],'dependencies':[('b','o')]}))), ['cancel-drop-order'])
check('completed-frame-return regression 0', solve(dict(base, **({'completed':True,'returned':['x','r'],'frame_slots':['r']}))), ['completed-frame-return'])
check('completed-frame-return regression 1', solve(dict(base, **({'completed':True,'returned':['x',N],'frame_slots':[N]}))), ['completed-frame-return'])
check('dead-loan-spill regression 0', solve(dict(base, **({'saved':['a','b'],'killed':['b']}))), ['dead-loan-spill'])
check('dead-loan-spill regression 1', solve(dict(base, **({'saved':[N,N+1],'killed':[N+1]}))), ['dead-loan-spill'])
check('variant-separation regression 0', solve(dict(base, **({'active_variant':'a','variant_loans':{'b':['r']},'common_loans':['r']}))), ['variant-separation'])
check('variant-separation regression 1', solve(dict(base, **({'active_variant':N,'variant_loans':{N+1:['r']},'common_loans':['r']}))), ['variant-separation'])
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 variant-specific suspension loan is treated as live in every frame state.

Validate static generator suspension descriptors. Live borrowed stack origins must be stored in the frame; movable frames cannot retain self references; pinned self references require pinned projection; a saved unique loan cannot have external aliases; suspension-disallowed guards cannot cross yield; resumed references must survive every resume point; cancellation drop order releases borrowers before owners; references returned by a completed generator cannot target its frame; loans killed before yield must not be saved; mutually exclusive variants require variant-specific frame loans. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if False: errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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 len(d['names'])>2 and len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
Duplicate pattern names overwrite an earlier binding fact.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if False: errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if bool(d['arm_names']) and set(d['arm_names'][0])!=set(d['names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
Later pattern alternatives introduce a different binding set.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if False: errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if len(d['arm_modes'])>2 and d['arm_modes'][0]!=d['arm_modes'][-1]: errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
Two pattern alternatives bind one name with incompatible ownership modes.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if False: errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not d['mutable'] and bool(d['mut_refs']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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 mutable pattern binding inherits mutability from another place.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if False: errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if bool(d['deref_moves']) and d['deref_moves'][0] not in d['copy']: errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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 through a reference moves a noncopy referent.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if False: errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if set(d['rest'])==set(d['positions']) and bool(d['rest']): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
Array rest binding overlaps an explicitly borrowed element.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if False: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe'] and not d['positions']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
Union field pattern extraction lacks its required unsafe boundary.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if False: errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if len(set(d['guard_bindings'])&set(d['escaping']))>1: errors.append('guard-scope')
    if any(a==b or a.startswith(b+'.') or b.startswith(a+'.') for a in d['moves'] for b in d['borrows']): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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-local borrowed pattern binding escapes to the arm body.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if False: errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if len(d['names'])!=len(set(d['names'])): errors.append('binding-uniqueness')
    if any(set(x)!=set(d['names']) for x in d['arm_names']): errors.append('alternative-name-agreement')
    if any(x!=d['arm_modes'][0] for x in d['arm_modes'][1:]): errors.append('alternative-mode-agreement')
    if not set(d['mut_refs'])<=set(d['mutable']): errors.append('mutable-binding')
    if not set(d['deref_moves'])<=set(d['copy']): errors.append('deref-move')
    if bool(set(d['rest'])&set(d['positions'])): errors.append('rest-disjointness')
    if d['union'] and not d['unsafe']: errors.append('union-pattern')
    if bool(set(d['guard_bindings'])&set(d['escaping'])): errors.append('guard-scope')
    if bool(set(d['moves'])&set(d['borrows'])): errors.append('move-borrow-overlap')
    if d['default_ref'] and bool(d['implicit_value']): errors.append('default-mode-reset')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'names': [], 'arm_names': [], 'arm_modes': [], 'mut_refs': [], 'mutable': [], 'deref_moves': [], 'copy': [], 'rest': [], 'positions': [], 'union': False, 'unsafe': False, 'guard_bindings': [], 'escaping': [], 'moves': [], 'borrows': [], 'default_ref': False, 'implicit_value': []}
check('well formed empty obligations',solve(base),[])
check('binding-uniqueness regression 0', solve(dict(base, **({'names':['x','x']}))), ['binding-uniqueness'])
check('binding-uniqueness regression 1', solve(dict(base, **({'names':[N,N]}))), ['binding-uniqueness'])
check('alternative-name-agreement regression 0', solve(dict(base, **({'names':['x'],'arm_names':[['x'],['y']]}))), ['alternative-name-agreement'])
check('alternative-name-agreement regression 1', solve(dict(base, **({'names':[N],'arm_names':[[N],[N+1]]}))), ['alternative-name-agreement'])
check('alternative-mode-agreement regression 0', solve(dict(base, **({'arm_modes':['ref','move']}))), ['alternative-mode-agreement'])
check('alternative-mode-agreement regression 1', solve(dict(base, **({'arm_modes':['ref','mut']}))), ['alternative-mode-agreement'])
check('mutable-binding regression 0', solve(dict(base, **({'mut_refs':['a','b'],'mutable':['a']}))), ['mutable-binding'])
check('mutable-binding regression 1', solve(dict(base, **({'mut_refs':[N],'mutable':[N+1]}))), ['mutable-binding'])
check('deref-move regression 0', solve(dict(base, **({'deref_moves':['a','b'],'copy':['a']}))), ['deref-move'])
check('deref-move regression 1', solve(dict(base, **({'deref_moves':[N,N+1],'copy':[N]}))), ['deref-move'])
check('rest-disjointness regression 0', solve(dict(base, **({'rest':[N,N+1],'positions':[N+1]}))), ['rest-disjointness'])
check('rest-disjointness regression 1', solve(dict(base, **({'rest':[N,N+1,N+2],'positions':[N]}))), ['rest-disjointness'])
check('union-pattern regression 0', solve(dict(base, **({'union':True}))), ['union-pattern'])
check('union-pattern regression 1', solve(dict(base, **({'union':True,'positions':list(range(N))}))), ['union-pattern'])
check('guard-scope regression 0', solve(dict(base, **({'guard_bindings':['r'],'escaping':['r']}))), ['guard-scope'])
check('guard-scope regression 1', solve(dict(base, **({'guard_bindings':[N],'escaping':[N]}))), ['guard-scope'])
check('move-borrow-overlap regression 0', solve(dict(base, **({'moves':['r'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('move-borrow-overlap regression 1', solve(dict(base, **({'moves':['r.f.g'],'borrows':['r.f']}))), ['move-borrow-overlap'])
check('default-mode-reset regression 0', solve(dict(base, **({'default_ref':True,'implicit_value':['x']}))), ['default-mode-reset'])
check('default-mode-reset regression 1', solve(dict(base, **({'default_ref':True,'implicit_value':[N]}))), ['default-mode-reset'])
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:
One pattern moves an ancestor of another binding borrowed by reference.

Check a toy destructuring pattern after type resolution. Binding names unique; alternatives bind identical name sets and modes; mutable reference binding needs mutable access; an explicit dereference pattern cannot move a noncopy referent; rest binding cannot overlap explicitly bound array positions; union fields require an explicit unsafe pattern; bindings introduced in a guard cannot escape guard region; simultaneous move and borrow of overlapping prefix places forbidden; a reference default binding mode cannot be reset implicitly by a plain identifier. 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