FA-91551 / Digital signal filters / Open access
Polyphase decimator reads negative indices from the end of the signal · case 01
Early outputs pick up samples from the tail of the buffer.
ROOT CAUSE
The bounds test only checks idx < L, so negative indices wrap around.
VERIFIED REPAIR
Require 0 <= idx < L.
Unsuccessful approach: The attempted repair uses 0 < idx, dropping x[0].
Case contract
Input [h, D, samples] (integers). Output y[m] = sum_k h[k] x[mD - k] for m = 0 .. ceil(len/D) - 1 with x = 0 outside the signal, computed through the polyphase split E_p[j] = h[jD + p].
Why this case matters
Polyphase decimators avoid computing discarded outputs; commutator and phase-split slips alias the output.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
h, D, xs = x
L = len(xs)
M = (L + D - 1) // D
phases = [h[p::D] for p in range(D)]
out = []
for m in range(M):
acc = 0
for p in range(D):
for j, c in enumerate(phases[p]):
idx = (m - j) * D - p
if idx < L:
acc += c * xs[idx]
out.append(acc)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: length divisible', [[1, 1], 2, [1, 2, 3, 4]], [1, 5]], ['regression: long filter D=3', [[1, 2, 3, 4, 5], 3, [1, 0, 0, 2, 0, 0, 3]], [1, 6, 11]], ['repair check: impulse through D=2', [[1, 2, 3], 2, [1, 0, 0, 0, 0]], [1, 3, 0]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]]], [['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['repair check: first sample matters', [[1], 3, [7, 1, 1, 1]], [7, 1]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]]], [['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]]], [['regression: random polyphase 9', [[1, -2, 2, 3, 1, 0], 3, [5, 2, 1, -3, 4, 0, 0, 1]], [5, 14, 0]], ['regression: random polyphase 10', [[3, -1, 1, 0, -2, 2], 4, [3, -3, 0, -3, 2, 1]], [9, 3]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]]], [['regression: random polyphase 12', [[-2, 3, 1, -3, 1, 2, 3], 3, [2, 5, 1, 5, -2, -2]], [-4, -8]], ['regression: random polyphase 13', [[1, 4], 2, [-4, 3, -1, 4]], [-4, 11]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 |
|---|---|---|---|
| regression: length divisible | [5, 5] | [1, 5] | Failed |
| regression: long filter D=3 | [17, 21, 11] | [1, 6, 11] | Failed |
| repair check: impulse through D=2 | [1, 3, 0] | [1, 3, 0] | Passed |
| control: random polyphase 30 | [0, -4] | [0, -4] | Passed |
| control: random polyphase 48 | [0, 16, 4, 0] | [0, 16, 4, 0] | Passed |
| regression: random polyphase 0 | [5, 11, -4, -3] | [6, 11, -4, -3] | Failed |
| regression: random polyphase 1 | [-12, 10] | [-6, 4] | Failed |
SHA-256 / f04ec33bad8f869e0515477dbe8f8b20791e19351591cfc9a0ecddf767d83a15
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
h, D, xs = x
L = len(xs)
M = (L + D - 1) // D
phases = [h[p::D] for p in range(D)]
out = []
for m in range(M):
acc = 0
for p in range(D):
for j, c in enumerate(phases[p]):
idx = (m - j) * D - p
if 0 < idx < L:
acc += c * xs[idx]
out.append(acc)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: length divisible', [[1, 1], 2, [1, 2, 3, 4]], [1, 5]], ['regression: long filter D=3', [[1, 2, 3, 4, 5], 3, [1, 0, 0, 2, 0, 0, 3]], [1, 6, 11]], ['repair check: impulse through D=2', [[1, 2, 3], 2, [1, 0, 0, 0, 0]], [1, 3, 0]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]]], [['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['repair check: first sample matters', [[1], 3, [7, 1, 1, 1]], [7, 1]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]]], [['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]]], [['regression: random polyphase 9', [[1, -2, 2, 3, 1, 0], 3, [5, 2, 1, -3, 4, 0, 0, 1]], [5, 14, 0]], ['regression: random polyphase 10', [[3, -1, 1, 0, -2, 2], 4, [3, -3, 0, -3, 2, 1]], [9, 3]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]]], [['regression: random polyphase 12', [[-2, 3, 1, -3, 1, 2, 3], 3, [2, 5, 1, 5, -2, -2]], [-4, -8]], ['regression: random polyphase 13', [[1, 4], 2, [-4, 3, -1, 4]], [-4, 11]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 |
|---|---|---|---|
| regression: length divisible | [0, 5] | [1, 5] | Failed |
| regression: long filter D=3 | [0, 2, 11] | [1, 6, 11] | Failed |
| repair check: impulse through D=2 | [0, 0, 0] | [1, 3, 0] | Failed |
| control: random polyphase 30 | [0, -4] | [0, -4] | Passed |
| control: random polyphase 48 | [0, 16, 4, 0] | [0, 16, 4, 0] | Passed |
| regression: random polyphase 0 | [0, 11, -4, -3] | [6, 11, -4, -3] | Failed |
| regression: random polyphase 1 | [0, 1] | [-6, 4] | Failed |
SHA-256 / 0061fb35459caee75ede7ffd41504bac17f91c29e0aad54622643229a48647ea
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
h, D, xs = x
L = len(xs)
M = (L + D - 1) // D
phases = [h[p::D] for p in range(D)]
out = []
for m in range(M):
acc = 0
for p in range(D):
for j, c in enumerate(phases[p]):
idx = (m - j) * D - p
if 0 <= idx < L:
acc += c * xs[idx]
out.append(acc)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: length divisible', [[1, 1], 2, [1, 2, 3, 4]], [1, 5]], ['regression: long filter D=3', [[1, 2, 3, 4, 5], 3, [1, 0, 0, 2, 0, 0, 3]], [1, 6, 11]], ['repair check: impulse through D=2', [[1, 2, 3], 2, [1, 0, 0, 0, 0]], [1, 3, 0]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]]], [['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['repair check: first sample matters', [[1], 3, [7, 1, 1, 1]], [7, 1]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]]], [['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]], ['regression: random polyphase 0', [[2, -1], 2, [3, -3, 4, -2, -3, 5, 1]], [6, 11, -4, -3]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 1', [[-2, 4, -1, -1, 1, -3], 4, [3, 0, 1, 0, -1, -2]], [-6, 4]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]]], [['regression: random polyphase 9', [[1, -2, 2, 3, 1, 0], 3, [5, 2, 1, -3, 4, 0, 0, 1]], [5, 14, 0]], ['regression: random polyphase 10', [[3, -1, 1, 0, -2, 2], 4, [3, -3, 0, -3, 2, 1]], [9, 3]], ['regression: random polyphase 2', [[4, 2, 3, -2, 4], 4, [-2, -4, 3, 0, -1, -2, 3, -1]], [-8, 5]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]]], [['regression: random polyphase 12', [[-2, 3, 1, -3, 1, 2, 3], 3, [2, 5, 1, 5, -2, -2]], [-4, -8]], ['regression: random polyphase 13', [[1, 4], 2, [-4, 3, -1, 4]], [-4, 11]], ['regression: random polyphase 4', [[0, -1, 1, -1, 4], 3, [3, 2, 5, 3, -1, 0, -3, 2, -1, -2]], [0, -6, 16, 6]], ['control: random polyphase 30', [[-1], 4, [0, -3, 0, -4, 4, 5]], [0, -4]], ['control: random polyphase 48', [[4], 2, [0, 5, 4, 2, 1, -1, 0, -3]], [0, 16, 4, 0]], ['regression: random polyphase 5', [[3, 1, -1, 0, -1], 2, [-3, 5, 4, 1]], [-9, 20]], ['regression: random polyphase 6', [[1, -2, 3, 2, -1], 4, [4, 3, 5, -3, -4, -2]], [4, 19]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
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 |
|---|---|---|---|
| regression: length divisible | [1, 5] | [1, 5] | Passed |
| regression: long filter D=3 | [1, 6, 11] | [1, 6, 11] | Passed |
| repair check: impulse through D=2 | [1, 3, 0] | [1, 3, 0] | Passed |
| control: random polyphase 30 | [0, -4] | [0, -4] | Passed |
| control: random polyphase 48 | [0, 16, 4, 0] | [0, 16, 4, 0] | Passed |
| regression: random polyphase 0 | [6, 11, -4, -3] | [6, 11, -4, -3] | Passed |
| regression: random polyphase 1 | [-6, 4] | [-6, 4] | Passed |
SHA-256 / a873a0d87497f60a27542a14c5c53d4df1d93b805095f5e2c5932df6793ccfc7
Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; exact rational arithmetic or fixed-decimal rounding keeps outputs strict JSON. It is not a production DSP library and claims no standards conformance. 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:51:36.955217+00:00.
Case digest / 740c79ee026ccb4296ccedd00b3f4dccbcfe91861c6b6827e5202424f77d658a