FA-4706 / Multiset accounting / Open access
Counter total includes negative and zero · case 01
The operation returns a result or retained state that violates this contract: The total sums all signed counts, including negative entries rather than counting expanded positive elements.
ROOT CAUSE
Counting expanded elements omits negative contributions.
VERIFIED REPAIR
The total sums all signed counts, including negative entries rather than counting expanded positive elements.
Unsuccessful approach: Counting keys ignores their signed multiplicities.
Case contract
The total sums all signed counts, including negative entries rather than counting expanded positive elements. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.
Why this case matters
A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return len(list(Counter(x).elements()))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative offsets positive', solve({'a': 3, 'b': -2, 'c': 0}), 1)
check('negative total', solve({'a': -3}), -3)
check('one member multiple count', solve({'a': 4}), 4)
check('empty', solve({}), 0)
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative offsets positive | 3 | 1 | Failed |
| negative total | 0 | -3 | Failed |
| one member multiple count | 4 | 4 | Passed |
| empty | 0 | 0 | Passed |
SHA-256 / 3017cb9d6e01b34fd54ec705cef40eced219b1f2bc6606f0ef31a3d6dcb690f1
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return len(x)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative offsets positive', solve({'a': 3, 'b': -2, 'c': 0}), 1)
check('negative total', solve({'a': -3}), -3)
check('one member multiple count', solve({'a': 4}), 4)
check('empty', solve({}), 0)
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative offsets positive | 3 | 1 | Failed |
| negative total | 1 | -3 | Failed |
| one member multiple count | 1 | 4 | Failed |
| empty | 0 | 0 | Passed |
SHA-256 / 76f557c03adfc808870924f6946350ea5537cea4dea7123e241b45f8d773aa6e
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return sum(Counter(x).values())
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative offsets positive', solve({'a': 3, 'b': -2, 'c': 0}), 1)
check('negative total', solve({'a': -3}), -3)
check('one member multiple count', solve({'a': 4}), 4)
check('empty', solve({}), 0)
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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| negative offsets positive | 1 | 1 | Passed |
| negative total | -3 | -3 | Passed |
| one member multiple count | 4 | 4 | Passed |
| empty | 0 | 0 | Passed |
SHA-256 / a7cd83964570e8bed23ca436bdc4f820cb59bb6ff97f0a9133853496689f7fd2
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:37:41.978322+00:00.
Case digest / fcdef37d9f7b6851b8340b92ac484e38645842a867afd0eebae1b018d8424209