FAILURE MAP
← Case archive

FA-4251 / Collection algebra / Open access

Stable set difference · case 01

The operation returns a result or retained state that violates this contract: Return distinct left values absent from right, preserving first appearance order.

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

ROOT CAUSE

Left duplicates are emitted repeatedly despite set semantics.

THE FAILURE

Left duplicates are emitted repeatedly despite set semantics.

Unsuccessful approach: Swapping operands computes the opposite difference.

Case contract

Return distinct left values absent from right, preserving first appearance order. 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 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 collapses', solve(['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 fixtureActualExpectedOutcome
both empty[][]Passed
empty right operand['a']['a']Passed
empty left operand[][]Passed
overlap and multiplicity['a']['a']Passed
unmatched duplicate collapses['a', 'a']['a']Failed

SHA-256 / eed690f1721520c5848728a43fdf61f8bacf0d6117915997816892f4fe166f56

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 dict.fromkeys(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 collapses', solve(['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 fixtureActualExpectedOutcome
both empty[][]Passed
empty right operand[]['a']Failed
empty left operand['b'][]Failed
overlap and multiplicity['c']['a']Failed
unmatched duplicate collapses[]['a']Failed

SHA-256 / 4cbc1b72e64342ac45a7a3b688e689e113d76bedd8c342472382a2a913a434f4

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 5 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 49061b1bb76de282fb4977d61390a50d1586f7e273e75f23c68e5ad014e7da29