FA-4286 / Collection algebra / Open access
Subsequence not subset · case 01
The operation returns a result or retained state that violates this contract: Return whether right is an order-preserving, multiplicity-respecting subsequence of left.
ROOT CAUSE
Independent membership tests reuse positions and ignore order.
VERIFIED REPAIR
Return whether right is an order-preserving, multiplicity-respecting subsequence of left.
Unsuccessful approach: Contiguous-window search rejects valid gapped subsequences.
Case contract
Return whether right is an order-preserving, multiplicity-respecting subsequence of left. 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 x for v in 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'], []), True)
check('empty left operand', solve([], ['b']), False)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('gapped subsequence succeeds', solve(['a','b','c'], ['a','c']), True)
check('reusing occurrence is forbidden', solve(['a'], ['a','a']), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| both empty | True | True | Passed |
| empty right operand | True | True | Passed |
| empty left operand | False | False | Passed |
| overlap and multiplicity | False | False | Passed |
| gapped subsequence succeeds | True | True | Passed |
| reusing occurrence is forbidden | True | False | Failed |
SHA-256 / 048819b09a83277988b25072648e9ee9d8b826b97a8d3e02256d90f080a6b6db
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 any(x[i:i+len(y)]==y for i in range(len(x)+1))
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'], []), True)
check('empty left operand', solve([], ['b']), False)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('gapped subsequence succeeds', solve(['a','b','c'], ['a','c']), True)
check('reusing occurrence is forbidden', solve(['a'], ['a','a']), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| both empty | True | True | Passed |
| empty right operand | True | True | Passed |
| empty left operand | False | False | Passed |
| overlap and multiplicity | False | False | Passed |
| gapped subsequence succeeds | False | True | Failed |
| reusing occurrence is forbidden | False | False | Passed |
SHA-256 / f020cb2a87059e3bdf6c1829f2e787deb7297aad1d5feef39ba62626dfdf2a7d
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 (lambda it: all(any(v==a for a in it) for v in y))(iter(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'], []), True)
check('empty left operand', solve([], ['b']), False)
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), False)
check('gapped subsequence succeeds', solve(['a','b','c'], ['a','c']), True)
check('reusing occurrence is forbidden', solve(['a'], ['a','a']), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| both empty | True | True | Passed |
| empty right operand | True | True | Passed |
| empty left operand | False | False | Passed |
| overlap and multiplicity | False | False | Passed |
| gapped subsequence succeeds | True | True | Passed |
| reusing occurrence is forbidden | False | False | Passed |
SHA-256 / e60defdbec8dd5d60086d157986efb4bce3679d509fa90da4bc82a6d14ff3f7a
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.566268+00:00.
Case digest / 8912b6bdf5622743059ebf0cfefbee4dcd13ef092192f5ed0e3729610549d50a