FA-4256 / Collection algebra / Open access
Left filter difference keeps occurrences · case 01
The operation returns a result or retained state that violates this contract: Retain all left occurrences with no equal value in right.
ROOT CAUSE
Distinct-value conversion removes repeated unmatched left occurrences.
VERIFIED REPAIR
Retain all left occurrences with no equal value in right.
Unsuccessful approach: Swapping operands emits unmatched right values instead.
Case contract
Retain all left occurrences with no equal value in right. 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 [v for v in dict.fromkeys(x) if v not in y]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['a'])
check('unmatched duplicate remains', solve(['a','a'], []), ['a','a'])
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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | ['a'] | ['a'] | Passed |
| empty left operand | [] | [] | Passed |
| overlap and multiplicity | ['a'] | ['a'] | Passed |
| unmatched duplicate remains | ['a'] | ['a', 'a'] | Failed |
SHA-256 / 8e427b18c21a61a788ee83bae89aca49cd0e933f387742bf95d6c9baf8c84cd0
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 [v for v in y if v not in x]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['a'])
check('unmatched duplicate remains', solve(['a','a'], []), ['a','a'])
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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | [] | ['a'] | Failed |
| empty left operand | ['b'] | [] | Failed |
| overlap and multiplicity | ['c', 'c'] | ['a'] | Failed |
| unmatched duplicate remains | [] | ['a', 'a'] | Failed |
SHA-256 / 8d4b6f4289ce7974f038cb546b0b1af8683de0c785ae92c42939c5e58781f03f
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 [v for v in x if v not in y]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('both empty', solve([], []), [])
check('empty right operand', solve(['a'], []), ['a'])
check('empty left operand', solve([], ['b']), [])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['a'])
check('unmatched duplicate remains', solve(['a','a'], []), ['a','a'])
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 |
|---|---|---|---|
| both empty | [] | [] | Passed |
| empty right operand | ['a'] | ['a'] | Passed |
| empty left operand | [] | [] | Passed |
| overlap and multiplicity | ['a'] | ['a'] | Passed |
| unmatched duplicate remains | ['a', 'a'] | ['a', 'a'] | Passed |
SHA-256 / f7d518499e21990323e86bc8199dbffdee1f4f0116ec90ba0e67c4bff7a65f14
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.189477+00:00.
Case digest / fb1774cf9628242a6d0f1d6f19459568f00c445e5b5c533415379fff4eef7a20