FA-4281 / Collection algebra / Open access
Alternating interleave preserves tail · case 01
The operation returns a result or retained state that violates this contract: Alternate left and right elements and retain the longer trailing suffix.
ROOT CAUSE
Zip truncation discards the longer trailing suffix.
VERIFIED REPAIR
Alternate left and right elements and retain the longer trailing suffix.
Unsuccessful approach: Concatenation fails to alternate between operands.
Case contract
Alternate left and right elements and retain the longer trailing suffix. 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 pair in zip(x,y) for v in pair]
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']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b', 'a', 'c', 'b', 'c'])
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 | ['b', 'b', 'a', 'c', 'b', 'c'] | ['b', 'b', 'a', 'c', 'b', 'c'] | Passed |
SHA-256 / a54042707798e1c2f2d473a461537974aa5b3e577f5274586924e8891afebd74
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 x+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']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b', 'a', 'c', 'b', 'c'])
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 | ['b'] | ['b'] | Passed |
| overlap and multiplicity | ['b', 'a', 'b', 'b', 'c', 'c'] | ['b', 'b', 'a', 'c', 'b', 'c'] | Failed |
SHA-256 / b8be59ba9ee1518f450683d0529cb8e42a6cf8007b4d18b90caff8c039d303cd
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 i in range(max(len(x),len(y))) for v in (x[i:i+1]+y[i:i+1])]
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']), ['b'])
check('overlap and multiplicity', solve(['b', 'a', 'b'], ['b', 'c', 'c']), ['b', 'b', 'a', 'c', 'b', 'c'])
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 | ['b'] | ['b'] | Passed |
| overlap and multiplicity | ['b', 'b', 'a', 'c', 'b', 'c'] | ['b', 'b', 'a', 'c', 'b', 'c'] | Passed |
SHA-256 / 0168001d77ad77e59ab1322275bcdae76aa9b36d1c27b2b2de84d00a69db634b
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.541311+00:00.
Case digest / ada5a1f2df5aec717e6ac3911e6099ef790484efd2045ad8966ca6a91865993f