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

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

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

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

prompt:
A pattern reference ends before the final guard expression use.

Check borrow state across guarded matches. Guard failure restores prearm ownership; guard evaluation cannot move a noncopy scrutinee; arm-local loans end before another arm; guard mutation cannot change a discriminant supporting a projected borrow; arm move commits only after guard success; pattern tests are shared observations; exhaustive join includes every reachable arm; nonexhaustive matches retain fallback state; guard temporaries die on failed guard; a borrowed binding used by guard remains valid through guard expression. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if False: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred'] and d['size']==0: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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:
Reused machine addresses are merged into one static allocation origin.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if False: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']>d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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 stale allocation generation is accepted by borrow provenance checking.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if False: errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size']: errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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 one-past pointer is converted to a usable reference.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if False: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live'] and d['dereference']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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:
Raw-to-reference conversion postpones origin liveness until a later dereference.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if False: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted'] and d['raw_reference']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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:
Integer address reconstruction invents a static borrow capability.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if False: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used'] and not d['address_equal']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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:
In-place reallocation preserves references tied to the old allocation epoch.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if False: errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not d['merged_owners'] and bool(d['zero_size_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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:
Distinct zero-sized owner identities collapse during provenance canonicalization.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

split: open-access


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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if False: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['active_variant'] is None: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
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 payload reference is justified by the wrong active-variant witness.

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. 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