{"abstract":"A phantom ownership marker incorrectly freezes lifetime covariance.","category":"Borrow checking","checks":12,"contract":"Infer lifetime parameter variance in a toy type tree. Variance signs are +1 covariant, -1 contravariant, 0 invariant; repeated different signs join to invariant. var(name); ref(lifetime,type) covariant both; mut(lifetime,type) covariant lifetime invariant payload; fn(argument,result) flips argument; tuple(list) joins; cell(type) invariant; phantom(type) covariant; array(type,length) covariant; opaque(parameters) invariant for every listed parameter; unused(name) contributes nothing. Return parameter-to-sign map.","evaluation_group":"s3-borrow-checking-variance-inference","failed_approach":"The partial repair uses elif kind=='phantom': children=[t[1]]; signs=[0], which still violates the stipulated analysis contract.","family":"s3-borrow-checking-variance-inference-phantom-ownership","id":"FA-43526","implementations":{"attempt":{"sha256":"ecfde2ca8b74a19b37fe4a8449370a9fd6242a444e4d97c02115b4cada1e5e30","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    def walk(t,sign):\n        kind=t[0]\n        if kind=='var': return {t[1]:sign}\n        if kind=='unused': return {}\n        if kind=='ref': children=[('var',t[1]),t[2]]; signs=[sign,sign]\n        elif kind=='mut': children=[('var',t[1]),t[2]]; signs=[sign,0]\n        elif kind=='fn': children=[t[1],t[2]]; signs=[-sign,sign]\n        elif kind=='tuple': children=t[1]; signs=[sign]*len(children)\n        elif kind=='cell': children=[t[1]]; signs=[0]\n        elif kind=='phantom': children=[t[1]]; signs=[0]\n        elif kind=='array': children=[t[1]]; signs=[sign]\n        elif kind=='opaque': children=[('var',p) for p in t[1]]; signs=[0]*len(children)\n        else: return {}\n        out={}\n        for child,s in zip(children,signs):\n            for p,v in walk(child,s).items():\n                out[p]=v if p not in out or out[p]==v else 0\n        return out\n    return walk(tree,1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('variable',solve(('var','a')),{'a':1})\ncheck('unused',solve(('unused','a')), {})\ncheck('shared',solve(('ref','a',('var','b'))),{'a':1,'b':1})\ncheck('mutable',solve(('mut','a',('var','b'))),{'a':1,'b':0})\ncheck('function',solve(('fn',('var','a'),('var','b'))),{'a':-1,'b':1})\ncheck('tuple',solve(('tuple',[('var','a'),('var','b')])),{'a':1,'b':1})\ncheck('cell',solve(('cell',('var','a'))),{'a':0})\ncheck('phantom',solve(('phantom',('var','a'))),{'a':1})\ncheck('opaque',solve(('opaque',['a','b'])),{'a':0,'b':0})\ncheck('both positions',solve(('fn',('var','a'),('var','a'))),{'a':0})\ncheck('array',solve(('array',('var','a'),N)),{'a':1})\ncheck('variable arity',solve(('tuple',[('var',str(i)) for i in range(N+1)])),{str(i):1 for i in range(N+1)})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"0ab4683a9c95376fda52342d185eb082d6fb5fba9cada18af1b423ed51290039","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    def walk(t,sign):\n        kind=t[0]\n        if kind=='var': return {t[1]:sign}\n        if kind=='unused': return {}\n        if kind=='ref': children=[('var',t[1]),t[2]]; signs=[sign,sign]\n        elif kind=='mut': children=[('var',t[1]),t[2]]; signs=[sign,0]\n        elif kind=='fn': children=[t[1],t[2]]; signs=[-sign,sign]\n        elif kind=='tuple': children=t[1]; signs=[sign]*len(children)\n        elif kind=='cell': children=[t[1]]; signs=[0]\n        elif kind=='phantom': children=[]; signs=[]\n        elif kind=='array': children=[t[1]]; signs=[sign]\n        elif kind=='opaque': children=[('var',p) for p in t[1]]; signs=[0]*len(children)\n        else: return {}\n        out={}\n        for child,s in zip(children,signs):\n            for p,v in walk(child,s).items():\n                out[p]=v if p not in out or out[p]==v else 0\n        return out\n    return walk(tree,1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('variable',solve(('var','a')),{'a':1})\ncheck('unused',solve(('unused','a')), {})\ncheck('shared',solve(('ref','a',('var','b'))),{'a':1,'b':1})\ncheck('mutable',solve(('mut','a',('var','b'))),{'a':1,'b':0})\ncheck('function',solve(('fn',('var','a'),('var','b'))),{'a':-1,'b':1})\ncheck('tuple',solve(('tuple',[('var','a'),('var','b')])),{'a':1,'b':1})\ncheck('cell',solve(('cell',('var','a'))),{'a':0})\ncheck('phantom',solve(('phantom',('var','a'))),{'a':1})\ncheck('opaque',solve(('opaque',['a','b'])),{'a':0,'b':0})\ncheck('both positions',solve(('fn',('var','a'),('var','a'))),{'a':0})\ncheck('array',solve(('array',('var','a'),N)),{'a':1})\ncheck('variable arity',solve(('tuple',[('var',str(i)) for i in range(N+1)])),{str(i):1 for i in range(N+1)})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"a1c0aadac82f1b47dd4624fe34dce0cabf2f31e95f3ad2501a6130bc28bed72d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tree):\n    def walk(t,sign):\n        kind=t[0]\n        if kind=='var': return {t[1]:sign}\n        if kind=='unused': return {}\n        if kind=='ref': children=[('var',t[1]),t[2]]; signs=[sign,sign]\n        elif kind=='mut': children=[('var',t[1]),t[2]]; signs=[sign,0]\n        elif kind=='fn': children=[t[1],t[2]]; signs=[-sign,sign]\n        elif kind=='tuple': children=t[1]; signs=[sign]*len(children)\n        elif kind=='cell': children=[t[1]]; signs=[0]\n        elif kind=='phantom': children=[t[1]]; signs=[sign]\n        elif kind=='array': children=[t[1]]; signs=[sign]\n        elif kind=='opaque': children=[('var',p) for p in t[1]]; signs=[0]*len(children)\n        else: return {}\n        out={}\n        for child,s in zip(children,signs):\n            for p,v in walk(child,s).items():\n                out[p]=v if p not in out or out[p]==v else 0\n        return out\n    return walk(tree,1)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('variable',solve(('var','a')),{'a':1})\ncheck('unused',solve(('unused','a')), {})\ncheck('shared',solve(('ref','a',('var','b'))),{'a':1,'b':1})\ncheck('mutable',solve(('mut','a',('var','b'))),{'a':1,'b':0})\ncheck('function',solve(('fn',('var','a'),('var','b'))),{'a':-1,'b':1})\ncheck('tuple',solve(('tuple',[('var','a'),('var','b')])),{'a':1,'b':1})\ncheck('cell',solve(('cell',('var','a'))),{'a':0})\ncheck('phantom',solve(('phantom',('var','a'))),{'a':1})\ncheck('opaque',solve(('opaque',['a','b'])),{'a':0,'b':0})\ncheck('both positions',solve(('fn',('var','a'),('var','a'))),{'a':0})\ncheck('array',solve(('array',('var','a'),N)),{'a':1})\ncheck('variable arity',solve(('tuple',[('var',str(i)) for i in range(N+1)])),{str(i):1 for i in range(N+1)})\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"The explicitly stated toy language is the complete scope; this is not a production compiler or a claim about Rust semantics. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-borrow-checking-variance-inference-phantom-ownership","generated_at":"2026-09-29T14:44:02.820223+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A finite offline static-analysis model of ownership and borrowing; it does not execute the analyzed program.","repair":"Apply the specified transfer or inference rule at this site: elif kind=='phantom': children=[t[1]]; signs=[sign].","root_cause":"The static analyzer mishandles phantom ownership: a phantom ownership marker incorrectly freezes lifetime covariance.","sha256":"b35b4c77707452cbe2f33bc12f51a6ba1d16b3c9442adf81791cfa8c0e05b943","title":"A phantom ownership marker incorrectly freezes lifetime covariance · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":46.87,"exit_code":1,"observations":[{"actual":{"a":1},"check":"variable","expected":{"a":1},"passed":true},{"actual":{},"check":"unused","expected":{},"passed":true},{"actual":{"a":1,"b":1},"check":"shared","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":1,"b":0},"check":"mutable","expected":{"a":1,"b":0},"passed":true},{"actual":{"a":-1,"b":1},"check":"function","expected":{"a":-1,"b":1},"passed":true},{"actual":{"a":1,"b":1},"check":"tuple","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":0},"check":"cell","expected":{"a":0},"passed":true},{"actual":{"a":0},"check":"phantom","expected":{"a":1},"passed":false},{"actual":{"a":0,"b":0},"check":"opaque","expected":{"a":0,"b":0},"passed":true},{"actual":{"a":0},"check":"both positions","expected":{"a":0},"passed":true},{"actual":{"a":1},"check":"array","expected":{"a":1},"passed":true},{"actual":{"0":1,"1":1},"check":"variable arity","expected":{"0":1,"1":1},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"variable\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"unused\", \"actual\": {}, \"expected\": {}, \"passed\": true}, {\"check\": \"shared\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"mutable\", \"actual\": {\"a\": 1, \"b\": 0}, \"expected\": {\"a\": 1, \"b\": 0}, \"passed\": true}, {\"check\": \"function\", \"actual\": {\"a\": -1, \"b\": 1}, \"expected\": {\"a\": -1, \"b\": 1}, \"passed\": true}, {\"check\": \"tuple\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"cell\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"phantom\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 1}, \"passed\": false}, {\"check\": \"opaque\", \"actual\": {\"a\": 0, \"b\": 0}, \"expected\": {\"a\": 0, \"b\": 0}, \"passed\": true}, {\"check\": \"both positions\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"array\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"variable arity\", \"actual\": {\"0\": 1, \"1\": 1}, \"expected\": {\"0\": 1, \"1\": 1}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.248,"exit_code":1,"observations":[{"actual":{"a":1},"check":"variable","expected":{"a":1},"passed":true},{"actual":{},"check":"unused","expected":{},"passed":true},{"actual":{"a":1,"b":1},"check":"shared","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":1,"b":0},"check":"mutable","expected":{"a":1,"b":0},"passed":true},{"actual":{"a":-1,"b":1},"check":"function","expected":{"a":-1,"b":1},"passed":true},{"actual":{"a":1,"b":1},"check":"tuple","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":0},"check":"cell","expected":{"a":0},"passed":true},{"actual":{},"check":"phantom","expected":{"a":1},"passed":false},{"actual":{"a":0,"b":0},"check":"opaque","expected":{"a":0,"b":0},"passed":true},{"actual":{"a":0},"check":"both positions","expected":{"a":0},"passed":true},{"actual":{"a":1},"check":"array","expected":{"a":1},"passed":true},{"actual":{"0":1,"1":1},"check":"variable arity","expected":{"0":1,"1":1},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"variable\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"unused\", \"actual\": {}, \"expected\": {}, \"passed\": true}, {\"check\": \"shared\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"mutable\", \"actual\": {\"a\": 1, \"b\": 0}, \"expected\": {\"a\": 1, \"b\": 0}, \"passed\": true}, {\"check\": \"function\", \"actual\": {\"a\": -1, \"b\": 1}, \"expected\": {\"a\": -1, \"b\": 1}, \"passed\": true}, {\"check\": \"tuple\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"cell\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"phantom\", \"actual\": {}, \"expected\": {\"a\": 1}, \"passed\": false}, {\"check\": \"opaque\", \"actual\": {\"a\": 0, \"b\": 0}, \"expected\": {\"a\": 0, \"b\": 0}, \"passed\": true}, {\"check\": \"both positions\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"array\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"variable arity\", \"actual\": {\"0\": 1, \"1\": 1}, \"expected\": {\"0\": 1, \"1\": 1}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.462,"exit_code":0,"observations":[{"actual":{"a":1},"check":"variable","expected":{"a":1},"passed":true},{"actual":{},"check":"unused","expected":{},"passed":true},{"actual":{"a":1,"b":1},"check":"shared","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":1,"b":0},"check":"mutable","expected":{"a":1,"b":0},"passed":true},{"actual":{"a":-1,"b":1},"check":"function","expected":{"a":-1,"b":1},"passed":true},{"actual":{"a":1,"b":1},"check":"tuple","expected":{"a":1,"b":1},"passed":true},{"actual":{"a":0},"check":"cell","expected":{"a":0},"passed":true},{"actual":{"a":1},"check":"phantom","expected":{"a":1},"passed":true},{"actual":{"a":0,"b":0},"check":"opaque","expected":{"a":0,"b":0},"passed":true},{"actual":{"a":0},"check":"both positions","expected":{"a":0},"passed":true},{"actual":{"a":1},"check":"array","expected":{"a":1},"passed":true},{"actual":{"0":1,"1":1},"check":"variable arity","expected":{"0":1,"1":1},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"variable\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"unused\", \"actual\": {}, \"expected\": {}, \"passed\": true}, {\"check\": \"shared\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"mutable\", \"actual\": {\"a\": 1, \"b\": 0}, \"expected\": {\"a\": 1, \"b\": 0}, \"passed\": true}, {\"check\": \"function\", \"actual\": {\"a\": -1, \"b\": 1}, \"expected\": {\"a\": -1, \"b\": 1}, \"passed\": true}, {\"check\": \"tuple\", \"actual\": {\"a\": 1, \"b\": 1}, \"expected\": {\"a\": 1, \"b\": 1}, \"passed\": true}, {\"check\": \"cell\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"phantom\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"opaque\", \"actual\": {\"a\": 0, \"b\": 0}, \"expected\": {\"a\": 0, \"b\": 0}, \"passed\": true}, {\"check\": \"both positions\", \"actual\": {\"a\": 0}, \"expected\": {\"a\": 0}, \"passed\": true}, {\"check\": \"array\", \"actual\": {\"a\": 1}, \"expected\": {\"a\": 1}, \"passed\": true}, {\"check\": \"variable arity\", \"actual\": {\"0\": 1, \"1\": 1}, \"expected\": {\"0\": 1, \"1\": 1}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}