FA-91646 / Digital signal filters / Open access
Linear-phase delay ignores leading zero taps · case 01
[0, 0, 1, 2, 1] reports a delay of 1 sample instead of 3.
ROOT CAUSE
The delay is computed from the trimmed support only.
THE FAILURE
The delay is computed from the trimmed support only.
Unsuccessful approach: The attempted repair adds the number of trailing zeros instead.
Case contract
Input integer taps. Strip leading and trailing zeros ("degenerate" if all zero). The trimmed support of length N is type 1/2 if symmetric (odd/even N), type 3/4 if antisymmetric (odd/even N), otherwise not linear phase. Return {"type", "group_delay": leading zeros + (N-1)/2 as a fraction string} or both None.
Why this case matters
Linear-phase type determines which responses an FIR can realize (e.g. no highpass for type 2); misclassification picks the wrong design.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
h = list(x)
lead = 0
while lead < len(h) and h[lead] == 0:
lead += 1
if lead == len(h):
return 'degenerate'
end = len(h)
while h[end - 1] == 0:
end -= 1
g = h[lead:end]
N = len(g)
sym = all(g[i] == g[N - 1 - i] for i in range(N))
anti = all(g[i] == -g[N - 1 - i] for i in range(N))
if sym:
typ = 1 if N % 2 else 2
elif anti:
typ = 3 if N % 2 else 4
else:
return {'type': None, 'group_delay': None}
return {'type': typ, 'group_delay': str(Fraction(N - 1, 2))}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: leading zeros symmetric', [0, 0, 1, 2, 1], {'type': 1, 'group_delay': '3'}], ['regression: padded type II', [0, 3, 3, 0, 0], {'type': 2, 'group_delay': '3/2'}], ['repair check: trailing zeros', [1, 2, 1, 0], {'type': 1, 'group_delay': '1'}], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}], ['control: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['control: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}]], [['regression: random linear phase 1', [0, 2, -2, 0, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['regression: random linear phase 5', [0, 0, -3, -3, -2, -3, -3, 0], {'type': 1, 'group_delay': '4'}], ['regression: padded type II', [0, 3, 3, 0, 0], {'type': 2, 'group_delay': '3/2'}], ['control: type IV', [1, -1], {'type': 4, 'group_delay': '1/2'}], ['control: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}]], [['regression: random linear phase 10', [0, 0, 0, -1, 1, 0], {'type': 4, 'group_delay': '7/2'}], ['regression: random linear phase 11', [0, 0, 2, -2, 0], {'type': 4, 'group_delay': '5/2'}], ['repair check: random linear phase 0', [-1, -2, -1, 0, 1, 2, 1, 0], {'type': 3, 'group_delay': '3'}], ['control: type IV longer', [2, 1, -1, -2], {'type': 4, 'group_delay': '3/2'}], ['control: single tap', [5], {'type': 1, 'group_delay': '0'}], ['control: random linear phase 2', [0, 0, 2, 0, 2, 0, -2, 0, 0], {'type': None, 'group_delay': None}], ['control: random linear phase 4', [0, 1, -1, -1, 0], {'type': None, 'group_delay': None}]], [['regression: random linear phase 15', [0, 0, 1, -1, -1, 1, 0, 0], {'type': 2, 'group_delay': '7/2'}], ['regression: random linear phase 16', [0, -3, -1, 1, 3, 0, 0], {'type': 4, 'group_delay': '5/2'}], ['repair check: random linear phase 3', [1, 0, 1, 0], {'type': 1, 'group_delay': '1'}], ['control: random linear phase 6', [0, 3, 2, -3], {'type': None, 'group_delay': None}], ['control: random linear phase 7', [0, 0, 0, 0, 0], 'degenerate'], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}]], [['regression: random linear phase 18', [0, 0, 3, 3, 0, 0], {'type': 2, 'group_delay': '5/2'}], ['regression: random linear phase 20', [0, 2, -2, 2, 0, 0], {'type': 1, 'group_delay': '2'}], ['repair check: random linear phase 8', [2, -2, -2, 2, 2, -2, 0, 0], {'type': 4, 'group_delay': '5/2'}], ['control: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['control: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}], ['control: type IV', [1, -1], {'type': 4, 'group_delay': '1/2'}], ['control: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}]]]
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: leading zeros symmetric | {'group_delay': '1', 'type': 1} | {'group_delay': '3', 'type': 1} | Failed |
| regression: padded type II | {'group_delay': '1/2', 'type': 2} | {'group_delay': '3/2', 'type': 2} | Failed |
| repair check: trailing zeros | {'group_delay': '1', 'type': 1} | {'group_delay': '1', 'type': 1} | Passed |
| control: type III nonzero centre | {'group_delay': None, 'type': None} | {'group_delay': None, 'type': None} | Passed |
| control: type III zero centre | {'group_delay': '1', 'type': 3} | {'group_delay': '1', 'type': 3} | Passed |
| control: type I | {'group_delay': '1', 'type': 1} | {'group_delay': '1', 'type': 1} | Passed |
| control: type II | {'group_delay': '1/2', 'type': 2} | {'group_delay': '1/2', 'type': 2} | Passed |
SHA-256 / 1acd1a7f2623f11ff80ad0853921848d0e6cf0df63fb7afa8e0ef3a038717b5d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
h = list(x)
lead = 0
while lead < len(h) and h[lead] == 0:
lead += 1
if lead == len(h):
return 'degenerate'
end = len(h)
while h[end - 1] == 0:
end -= 1
g = h[lead:end]
N = len(g)
sym = all(g[i] == g[N - 1 - i] for i in range(N))
anti = all(g[i] == -g[N - 1 - i] for i in range(N))
if sym:
typ = 1 if N % 2 else 2
elif anti:
typ = 3 if N % 2 else 4
else:
return {'type': None, 'group_delay': None}
return {'type': typ, 'group_delay': str(len(h) - end + Fraction(N - 1, 2))}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: leading zeros symmetric', [0, 0, 1, 2, 1], {'type': 1, 'group_delay': '3'}], ['regression: padded type II', [0, 3, 3, 0, 0], {'type': 2, 'group_delay': '3/2'}], ['repair check: trailing zeros', [1, 2, 1, 0], {'type': 1, 'group_delay': '1'}], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}], ['control: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['control: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}]], [['regression: random linear phase 1', [0, 2, -2, 0, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['regression: random linear phase 5', [0, 0, -3, -3, -2, -3, -3, 0], {'type': 1, 'group_delay': '4'}], ['regression: padded type II', [0, 3, 3, 0, 0], {'type': 2, 'group_delay': '3/2'}], ['control: type IV', [1, -1], {'type': 4, 'group_delay': '1/2'}], ['control: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}]], [['regression: random linear phase 10', [0, 0, 0, -1, 1, 0], {'type': 4, 'group_delay': '7/2'}], ['regression: random linear phase 11', [0, 0, 2, -2, 0], {'type': 4, 'group_delay': '5/2'}], ['repair check: random linear phase 0', [-1, -2, -1, 0, 1, 2, 1, 0], {'type': 3, 'group_delay': '3'}], ['control: type IV longer', [2, 1, -1, -2], {'type': 4, 'group_delay': '3/2'}], ['control: single tap', [5], {'type': 1, 'group_delay': '0'}], ['control: random linear phase 2', [0, 0, 2, 0, 2, 0, -2, 0, 0], {'type': None, 'group_delay': None}], ['control: random linear phase 4', [0, 1, -1, -1, 0], {'type': None, 'group_delay': None}]], [['regression: random linear phase 15', [0, 0, 1, -1, -1, 1, 0, 0], {'type': 2, 'group_delay': '7/2'}], ['regression: random linear phase 16', [0, -3, -1, 1, 3, 0, 0], {'type': 4, 'group_delay': '5/2'}], ['repair check: random linear phase 3', [1, 0, 1, 0], {'type': 1, 'group_delay': '1'}], ['control: random linear phase 6', [0, 3, 2, -3], {'type': None, 'group_delay': None}], ['control: random linear phase 7', [0, 0, 0, 0, 0], 'degenerate'], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}]], [['regression: random linear phase 18', [0, 0, 3, 3, 0, 0], {'type': 2, 'group_delay': '5/2'}], ['regression: random linear phase 20', [0, 2, -2, 2, 0, 0], {'type': 1, 'group_delay': '2'}], ['repair check: random linear phase 8', [2, -2, -2, 2, 2, -2, 0, 0], {'type': 4, 'group_delay': '5/2'}], ['control: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['control: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}], ['control: type IV', [1, -1], {'type': 4, 'group_delay': '1/2'}], ['control: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}]]]
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: leading zeros symmetric | {'group_delay': '1', 'type': 1} | {'group_delay': '3', 'type': 1} | Failed |
| regression: padded type II | {'group_delay': '5/2', 'type': 2} | {'group_delay': '3/2', 'type': 2} | Failed |
| repair check: trailing zeros | {'group_delay': '2', 'type': 1} | {'group_delay': '1', 'type': 1} | Failed |
| control: type III nonzero centre | {'group_delay': None, 'type': None} | {'group_delay': None, 'type': None} | Passed |
| control: type III zero centre | {'group_delay': '1', 'type': 3} | {'group_delay': '1', 'type': 3} | Passed |
| control: type I | {'group_delay': '1', 'type': 1} | {'group_delay': '1', 'type': 1} | Passed |
| control: type II | {'group_delay': '1/2', 'type': 2} | {'group_delay': '1/2', 'type': 2} | Passed |
SHA-256 / 94564daf2697543dfd790afb4842e23e7a7e847f9da4ea1f3de8cb92229a4a90
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 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
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:38.101502+00:00.
Case digest / 80ca2f3ae48c31f5dcc03f3491f8fcc46135855eb7afffa1521b4e8a851a4f8c