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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and arg not in h
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Weak upgrade succeeds only while an owner retains the object and the destination is fresh.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Weak upgrade succeeds only while an owner retains the object and the destination is fresh. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind is not None: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner': destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Dropping the final owner destroys the object, but dropping a borrower must not destroy a still-owned object.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Dropping the final owner destroys the object, but dropping a borrower must not destroy a still-owned object. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and k!=arg
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Moving requires a present source and absent destination; it cannot erase another owner.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Moving requires a present source and absent destination; it cannot erase another owner. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                pass
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                h[k]='borrow'
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Successful move removes the source handle without altering the retained-owner count.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Successful move removes the source handle without altering the retained-owner count. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(k in h)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow'))
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Owners and borrowers are usable only while the resource remains retained and undestroyed; weak handles are not directly usable.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Owners and borrowers are usable only while the resource remains retained and undestroyed; weak handles are not directly usable. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and len(h)==1)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and arg not in h and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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:
The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. An owner is unique when exactly one owner exists, regardless of weak and borrowed handles.

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. An owner is unique when exactly one owner exists, regardless of weak and borrowed handles. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. A shared borrow requires a live object, no exclusive borrower, and a fresh token.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. A shared borrow requires a live object, no exclusive borrower, and a fresh token. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. An exclusive borrow requires a live object and no outstanding borrow of either kind.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. An exclusive borrow requires a live object and no outstanding borrow of either kind. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if True: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if k not in shared: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Releasing an unrelated token must not clear the exclusive borrow.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Releasing an unrelated token must not clear the exclusive borrow. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if k in shared or k==exclusive else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Only a current shared or exclusive token may read the live object.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Only a current shared or exclusive token may read the live object. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and (k in shared or k==exclusive)
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Only the active exclusive token can write a live object.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Only the active exclusive token can write a live object. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Direct owner writes require a live object with no outstanding borrow.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Direct owner writes require a live object with no outstanding borrow. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and exclusive is None
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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)

evaluation_group: xr-suite-shared-borrow-excludes-writer

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

N = 1
observations = []
def solve(x, y=None):
    shared=set(); exclusive=None; value=y; live=True; out=[]
    for op,k,arg in x:
        if op=='shared':
            ok=live and exclusive is None and k not in shared
            if ok: shared.add(k)
            out.append(ok)
        elif op=='exclusive':
            ok=live and not shared and exclusive is None
            if ok: exclusive=k
            out.append(ok)
        elif op=='release':
            shared.discard(k)
            if exclusive==k: exclusive=None
            out.append(True)
        elif op=='read':
            out.append(value if live and (k in shared or (exclusive is not None and k==exclusive)) else 'denied')
        elif op=='write':
            ok=live and exclusive is not None and k==exclusive
            if ok: value=arg
            out.append(ok)
        elif op=='ownerwrite':
            ok=live and not shared and exclusive is None
            if ok: value=arg
            out.append(ok)
        elif op=='move':
            ok=live and not shared
            if ok: live=False
            out.append(ok)
        elif op=='inspect': out.append([value,live,sorted(shared),exclusive])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shared readers prohibit mutation', solve([['shared', 'a', None], ['shared', 'a', None], ['shared', 'b', None], ['exclusive', 'w', None], ['write', 'a', 'bad'], ['ownerwrite', None, 'bad'], ['move', None, None], ['read', 'a', None], ['read', 'ghost', None], ['inspect', None, None]], 'initial'), [True, False, True, False, False, False, False, 'initial', 'denied', ['initial', True, ['a', 'b'], None]])
check('exclusive token protects identity', solve([['exclusive', 'w', None], ['exclusive', 'other', None], ['shared', 'a', None], ['write', 'ghost', 'bad'], ['release', 'ghost', None], ['ownerwrite', None, 'bad'], ['move', None, None], ['write', 'w', 'new'], ['read', 'w', None], ['inspect', None, None]], 'initial'), [True, False, False, False, True, False, False, True, 'new', ['new', True, [], 'w']])
check('released token loses rights', solve([['shared', 'a', None], ['release', 'a', None], ['read', 'a', None], ['exclusive', 'w', None], ['release', 'w', None], ['write', 'w', 'bad'], ['ownerwrite', None, 'new'], ['inspect', None, None]], 'initial'), [True, True, 'denied', True, True, False, True, ['new', True, [], None]])
check('moved object stays unavailable', solve([['move', None, None], ['shared', 'a', None], ['exclusive', 'w', None], ['ownerwrite', None, 'bad'], ['read', None, None], ['move', None, None], ['inspect', None, None]], 'initial'), [True, False, False, False, 'denied', False, ['initial', False, [], None]])
check('None is not a borrowed token', solve([['read',None,None]], 'initial'), ['denied'])
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:
The operation returns a result or retained state that violates this contract: A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Moving ownership requires a live object and no shared or exclusive borrows.

A single local object grants either any number of shared borrows or one exclusive borrow. Commands are [operation,token,value]. Reads return the value or denied; writes and acquisitions return booleans. Ownership can move only with no borrows. Moving ownership requires a live object and no shared or exclusive borrows. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access