{"abstract":"The operation returns a result or retained state that violates this contract: Subtract right counts from left counts and retain zero and negative entries in insertion order.","category":"Multiset accounting","checks":4,"contract":"Subtract right counts from left counts and retain zero and negative entries in insertion order. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","evaluation_group":"model-e3761480f46d3f9b","failed_approach":"Filtering only zeros still loses explicitly retained zero bindings.","family":"xr-counter-subtract-retains-nonpositive-counts","id":"FA-4661","implementations":{"attempt":{"sha256":"43ec0283dade9279e3c50b8e688080563d775678ab0107a338f4e2bea2691efc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    a=Counter(x); a.subtract(y); return [[k,v] for k,v in a.items() if v!=0]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('zero and negative retained', solve({'a': 2, 'b': 1}, {'a': 2, 'b': 3, 'c': 1}), [['a', 0], ['b', -2], ['c', -1]])\ncheck('empty left', solve({}, {'a': 1}), [['a', -1]])\ncheck('empty right', solve({'a': 0}, {}), [['a', 0]])\ncheck('both empty', solve({}, {}), [])\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":"5859c2224f370af380566892709dd030441288baf238bb33098d2f287694233d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    return list(map(list,(Counter(x)-Counter(y)).items()))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('zero and negative retained', solve({'a': 2, 'b': 1}, {'a': 2, 'b': 3, 'c': 1}), [['a', 0], ['b', -2], ['c', -1]])\ncheck('empty left', solve({}, {'a': 1}), [['a', -1]])\ncheck('empty right', solve({'a': 0}, {}), [['a', 0]])\ncheck('both empty', solve({}, {}), [])\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":"56bd3ccca11fec6996e2c2fe794baec94421df0e039e7ae9fa6300d7898829a4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    a=Counter(x); a.subtract(y); return list(map(list,a.items()))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('zero and negative retained', solve({'a': 2, 'b': 1}, {'a': 2, 'b': 3, 'c': 1}), [['a', 0], ['b', -2], ['c', -1]])\ncheck('empty left', solve({}, {'a': 1}), [['a', -1]])\ncheck('empty right', solve({'a': 0}, {}), [['a', 0]])\ncheck('both empty', solve({}, {}), [])\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":" 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":"xr-counter-subtract-retains-nonpositive-counts","generated_at":"2026-09-29T14:37:41.471294+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.","repair":"Subtract right counts from left counts and retain zero and negative entries in insertion order.","root_cause":"Counter subtraction applies positive-bag normalization and discards zero and negative entries.","sha256":"fea9755d34f88b2cd6eab91c10f23bde464e7b8f12ba470279fce590719c0411","title":"Counter subtract retains nonpositive counts · case 01","variant":1,"variant_policy":"Five execution reruns of a fixed adversarial fixture suite; variant number does not alter semantic inputs.","verification":{"attempt":{"elapsed_ms":36.737,"exit_code":1,"observations":[{"actual":[["b",-2],["c",-1]],"check":"zero and negative retained","expected":[["a",0],["b",-2],["c",-1]],"passed":false},{"actual":[["a",-1]],"check":"empty left","expected":[["a",-1]],"passed":true},{"actual":[],"check":"empty right","expected":[["a",0]],"passed":false},{"actual":[],"check":"both empty","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"zero and negative retained\", \"actual\": [[\"b\", -2], [\"c\", -1]], \"expected\": [[\"a\", 0], [\"b\", -2], [\"c\", -1]], \"passed\": false}, {\"check\": \"empty left\", \"actual\": [[\"a\", -1]], \"expected\": [[\"a\", -1]], \"passed\": true}, {\"check\": \"empty right\", \"actual\": [], \"expected\": [[\"a\", 0]], \"passed\": false}, {\"check\": \"both empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.638,"exit_code":1,"observations":[{"actual":[],"check":"zero and negative retained","expected":[["a",0],["b",-2],["c",-1]],"passed":false},{"actual":[],"check":"empty left","expected":[["a",-1]],"passed":false},{"actual":[],"check":"empty right","expected":[["a",0]],"passed":false},{"actual":[],"check":"both empty","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"zero and negative retained\", \"actual\": [], \"expected\": [[\"a\", 0], [\"b\", -2], [\"c\", -1]], \"passed\": false}, {\"check\": \"empty left\", \"actual\": [], \"expected\": [[\"a\", -1]], \"passed\": false}, {\"check\": \"empty right\", \"actual\": [], \"expected\": [[\"a\", 0]], \"passed\": false}, {\"check\": \"both empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":37.108,"exit_code":0,"observations":[{"actual":[["a",0],["b",-2],["c",-1]],"check":"zero and negative retained","expected":[["a",0],["b",-2],["c",-1]],"passed":true},{"actual":[["a",-1]],"check":"empty left","expected":[["a",-1]],"passed":true},{"actual":[["a",0]],"check":"empty right","expected":[["a",0]],"passed":true},{"actual":[],"check":"both empty","expected":[],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"zero and negative retained\", \"actual\": [[\"a\", 0], [\"b\", -2], [\"c\", -1]], \"expected\": [[\"a\", 0], [\"b\", -2], [\"c\", -1]], \"passed\": true}, {\"check\": \"empty left\", \"actual\": [[\"a\", -1]], \"expected\": [[\"a\", -1]], \"passed\": true}, {\"check\": \"empty right\", \"actual\": [[\"a\", 0]], \"expected\": [[\"a\", 0]], \"passed\": true}, {\"check\": \"both empty\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}