FAILURE MAP
← Case archive

FA-4696 / Multiset accounting / Open access

Counter intersection minimum positive count · case 01

The operation returns a result or retained state that violates this contract: Counter intersection takes the minimum count for shared members and drops nonpositive results.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Unfiltered minima retain nonpositive counts and absent members as zero.

VERIFIED REPAIR

Counter intersection takes the minimum count for shared members and drops nonpositive results.

Unsuccessful approach: Set intersection loses occurrence counts by assigning one to every shared member.

Case contract

Counter intersection takes the minimum count for shared members and drops nonpositive results. 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 {k:min(v,y.get(k,0)) for k,v in x.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('counts matter', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2})
check('nonpositive omitted', solve({'a': -1}, {'a': 2}), {})
check('empty right', solve({'a': 1}, {}), {})
check('empty both', solve({}, {}), {})
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 fixtureActualExpectedOutcome
counts matter{'a': 2, 'b': 0}{'a': 2}Failed
nonpositive omitted{'a': -1}{}Failed
empty right{'a': 0}{}Failed
empty both{}{}Passed

SHA-256 / 5de0b855a2a8466a7540df8936d513c75f0045fd285eb436aa7ad15a6ec34030

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 {k:1 for k in x if k in y}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('counts matter', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2})
check('nonpositive omitted', solve({'a': -1}, {'a': 2}), {})
check('empty right', solve({'a': 1}, {}), {})
check('empty both', solve({}, {}), {})
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 fixtureActualExpectedOutcome
counts matter{'a': 1}{'a': 2}Failed
nonpositive omitted{'a': 1}{}Failed
empty right{}{}Passed
empty both{}{}Passed

SHA-256 / eb0fdf2c59539a923056fd5d350b5ff2a48095ab1fd9d8adad2f58b3ff690db3

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 dict(Counter(x)&Counter(y))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('counts matter', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2})
check('nonpositive omitted', solve({'a': -1}, {'a': 2}), {})
check('empty right', solve({'a': 1}, {}), {})
check('empty both', solve({}, {}), {})
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 fixtureActualExpectedOutcome
counts matter{'a': 2}{'a': 2}Passed
nonpositive omitted{}{}Passed
empty right{}{}Passed
empty both{}{}Passed

SHA-256 / 59a326a4200fa5c45dd4868c43ac0943d540c70f9aeb72e6d0378dbd951664b0

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.865435+00:00.

Case digest / 3df3e491c411f3ec17be8019c19062436cf9170c17a0fe035507d7248e27c46a