FAILURE MAP
← Case archive

FA-4311 / Collection algebra / Open access

Multiset subset respects counts · case 01

The operation returns a result or retained state that violates this contract: Return whether every left occurrence can be matched to a distinct equal right occurrence.

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

ROOT CAUSE

Membership tests do not reserve a distinct matching copy for each occurrence.

VERIFIED REPAIR

Return whether every left occurrence can be matched to a distinct equal right occurrence.

Unsuccessful approach: Strict set inclusion rejects equality and ignores count constraints.

Case contract

Return whether every left occurrence can be matched to a distinct equal right occurrence. 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

N = 1
observations = []
def solve(x, y=None):
    return all(v in y for v in x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), True)
check('empty right operand', solve(['a'], []), False)
check('empty left operand', solve([], ['b']), True)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('equal bags are contained', solve(['a'], ['a']), True)
check('membership does not imply enough copies', solve(['a','a'], ['a','b']), False)
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
both emptyTrueTruePassed
empty right operandFalseFalsePassed
empty left operandTrueTruePassed
overlap and multiplicityFalseFalsePassed
equal bags are containedTrueTruePassed
membership does not imply enough copiesTrueFalseFailed

SHA-256 / 9ed53e79dbd50fcbd0d33653ab2076f3dddc98f33620f3fe2b64b7a648a1cfda

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    return set(x)<set(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), True)
check('empty right operand', solve(['a'], []), False)
check('empty left operand', solve([], ['b']), True)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('equal bags are contained', solve(['a'], ['a']), True)
check('membership does not imply enough copies', solve(['a','a'], ['a','b']), False)
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
both emptyFalseTrueFailed
empty right operandFalseFalsePassed
empty left operandTrueTruePassed
overlap and multiplicityFalseFalsePassed
equal bags are containedFalseTrueFailed
membership does not imply enough copiesTrueFalseFailed

SHA-256 / 322ccb2ad3a2cd6b6d0e71fea09b6b34e5e206685db810f5f445f33265c8c2c6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    return all(x.count(v)<=y.count(v) for v in x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), True)
check('empty right operand', solve(['a'], []), False)
check('empty left operand', solve([], ['b']), True)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('equal bags are contained', solve(['a'], ['a']), True)
check('membership does not imply enough copies', solve(['a','a'], ['a','b']), False)
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
both emptyTrueTruePassed
empty right operandFalseFalsePassed
empty left operandTrueTruePassed
overlap and multiplicityFalseFalsePassed
equal bags are containedTrueTruePassed
membership does not imply enough copiesFalseFalsePassed

SHA-256 / 024121b0f25f555ffa1e8ccb9f5df750bddfd53cd7a348ce189a991afb37c2cf

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

Case digest / 770c9411400e8a2eafa1523e86dd5d898e1e5fa7c4ef807833e5e1996b8c20a4