{"abstract":"An odd-length symmetric filter is labelled type 2.","category":"Digital signal filters","checks":7,"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.","evaluation_group":"w2-digital_signal_filters-linear-phase-classifier","failed_approach":"The attempted change swaps the antisymmetric mapping as well, mislabelling types 3 and 4.","family":"w2-digital_signal_filters-linear-phase-classifier-symmetric-type-parity","id":"FA-91651","implementations":{"attempt":{"sha256":"84fc97623fc53d4bbad3798d1363a6863fb0af93936c84c5ef125825b2e05c94","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    h = list(x)\n    lead = 0\n    while lead < len(h) and h[lead] == 0:\n        lead += 1\n    if lead == len(h):\n        return 'degenerate'\n    end = len(h)\n    while h[end - 1] == 0:\n        end -= 1\n    g = h[lead:end]\n    N = len(g)\n    sym = all(g[i] == g[N - 1 - i] for i in range(N))\n    anti = all(g[i] == -g[N - 1 - i] for i in range(N))\n    if sym:\n        typ = 1 if N % 2 else 2\n    elif anti:\n        typ = 4 if N % 2 else 3\n    else:\n        return {'type': None, 'group_delay': None}\n    return {'type': typ, 'group_delay': str(lead + Fraction(N - 1, 2))}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['regression: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}], ['repair check: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['control: random linear phase 2', [0, 0, 2, 0, 2, 0, -2, 0, 0], {'type': None, 'group_delay': None}]], [['regression: trailing zeros', [1, 2, 1, 0], {'type': 1, 'group_delay': '1'}], ['regression: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}], ['repair check: type IV longer', [2, 1, -1, -2], {'type': 4, 'group_delay': '3/2'}], ['control: random linear phase 4', [0, 1, -1, -1, 0], {'type': None, 'group_delay': None}], ['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}]], [['regression: single tap', [5], {'type': 1, 'group_delay': '0'}], ['regression: padded interior zeros', [0, 2, 0, 0, 2], {'type': 2, 'group_delay': '5/2'}], ['repair check: random linear phase 1', [0, 2, -2, 0, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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 5', [0, 0, -3, -3, -2, -3, -3, 0], {'type': 1, 'group_delay': '4'}], ['regression: random linear phase 9', [0, 0, -1, -3, 3, -1, 3, -3, -1, 0, 0], {'type': 1, 'group_delay': '5'}], ['repair check: random linear phase 10', [0, 0, 0, -1, 1, 0], {'type': 4, 'group_delay': '7/2'}], ['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: all zero', [0, 0, 0], 'degenerate']], [['regression: random linear phase 15', [0, 0, 1, -1, -1, 1, 0, 0], {'type': 2, 'group_delay': '7/2'}], ['regression: random linear phase 17', [0, -3, 1, 3, -1, 3, 1, -3], {'type': 1, 'group_delay': '4'}], ['repair check: random linear phase 12', [-1, 1, -1, 1, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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}], ['control: random linear phase 6', [0, 3, 2, -3], {'type': None, 'group_delay': None}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"9f34d597bf4c6b0f51150460e153ff908eaa93df47846b4624d70beafbe152b5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    h = list(x)\n    lead = 0\n    while lead < len(h) and h[lead] == 0:\n        lead += 1\n    if lead == len(h):\n        return 'degenerate'\n    end = len(h)\n    while h[end - 1] == 0:\n        end -= 1\n    g = h[lead:end]\n    N = len(g)\n    sym = all(g[i] == g[N - 1 - i] for i in range(N))\n    anti = all(g[i] == -g[N - 1 - i] for i in range(N))\n    if sym:\n        typ = 2 if N % 2 else 1\n    elif anti:\n        typ = 3 if N % 2 else 4\n    else:\n        return {'type': None, 'group_delay': None}\n    return {'type': typ, 'group_delay': str(lead + Fraction(N - 1, 2))}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['regression: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}], ['repair check: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['control: random linear phase 2', [0, 0, 2, 0, 2, 0, -2, 0, 0], {'type': None, 'group_delay': None}]], [['regression: trailing zeros', [1, 2, 1, 0], {'type': 1, 'group_delay': '1'}], ['regression: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}], ['repair check: type IV longer', [2, 1, -1, -2], {'type': 4, 'group_delay': '3/2'}], ['control: random linear phase 4', [0, 1, -1, -1, 0], {'type': None, 'group_delay': None}], ['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}]], [['regression: single tap', [5], {'type': 1, 'group_delay': '0'}], ['regression: padded interior zeros', [0, 2, 0, 0, 2], {'type': 2, 'group_delay': '5/2'}], ['repair check: random linear phase 1', [0, 2, -2, 0, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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 5', [0, 0, -3, -3, -2, -3, -3, 0], {'type': 1, 'group_delay': '4'}], ['regression: random linear phase 9', [0, 0, -1, -3, 3, -1, 3, -3, -1, 0, 0], {'type': 1, 'group_delay': '5'}], ['repair check: random linear phase 10', [0, 0, 0, -1, 1, 0], {'type': 4, 'group_delay': '7/2'}], ['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: all zero', [0, 0, 0], 'degenerate']], [['regression: random linear phase 15', [0, 0, 1, -1, -1, 1, 0, 0], {'type': 2, 'group_delay': '7/2'}], ['regression: random linear phase 17', [0, -3, 1, 3, -1, 3, 1, -3], {'type': 1, 'group_delay': '4'}], ['repair check: random linear phase 12', [-1, 1, -1, 1, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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}], ['control: random linear phase 6', [0, 3, 2, -3], {'type': None, 'group_delay': None}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"ce6d46c32194e189bff891ddf2e06bbf1f8f7aacd21528f1161ed6c3106c8174","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    h = list(x)\n    lead = 0\n    while lead < len(h) and h[lead] == 0:\n        lead += 1\n    if lead == len(h):\n        return 'degenerate'\n    end = len(h)\n    while h[end - 1] == 0:\n        end -= 1\n    g = h[lead:end]\n    N = len(g)\n    sym = all(g[i] == g[N - 1 - i] for i in range(N))\n    anti = all(g[i] == -g[N - 1 - i] for i in range(N))\n    if sym:\n        typ = 1 if N % 2 else 2\n    elif anti:\n        typ = 3 if N % 2 else 4\n    else:\n        return {'type': None, 'group_delay': None}\n    return {'type': typ, 'group_delay': str(lead + Fraction(N - 1, 2))}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: type I', [1, 2, 1], {'type': 1, 'group_delay': '1'}], ['regression: type II', [1, 1], {'type': 2, 'group_delay': '1/2'}], ['repair check: type III zero centre', [1, 0, -1], {'type': 3, 'group_delay': '1'}], ['control: type III nonzero centre', [1, 2, -1], {'type': None, 'group_delay': None}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['control: random linear phase 2', [0, 0, 2, 0, 2, 0, -2, 0, 0], {'type': None, 'group_delay': None}]], [['regression: trailing zeros', [1, 2, 1, 0], {'type': 1, 'group_delay': '1'}], ['regression: interior zero symmetric', [1, 0, 1], {'type': 1, 'group_delay': '1'}], ['repair check: type IV longer', [2, 1, -1, -2], {'type': 4, 'group_delay': '3/2'}], ['control: random linear phase 4', [0, 1, -1, -1, 0], {'type': None, 'group_delay': None}], ['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}]], [['regression: single tap', [5], {'type': 1, 'group_delay': '0'}], ['regression: padded interior zeros', [0, 2, 0, 0, 2], {'type': 2, 'group_delay': '5/2'}], ['repair check: random linear phase 1', [0, 2, -2, 0, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: all zero', [0, 0, 0], 'degenerate'], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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 5', [0, 0, -3, -3, -2, -3, -3, 0], {'type': 1, 'group_delay': '4'}], ['regression: random linear phase 9', [0, 0, -1, -3, 3, -1, 3, -3, -1, 0, 0], {'type': 1, 'group_delay': '5'}], ['repair check: random linear phase 10', [0, 0, 0, -1, 1, 0], {'type': 4, 'group_delay': '7/2'}], ['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: all zero', [0, 0, 0], 'degenerate']], [['regression: random linear phase 15', [0, 0, 1, -1, -1, 1, 0, 0], {'type': 2, 'group_delay': '7/2'}], ['regression: random linear phase 17', [0, -3, 1, 3, -1, 3, 1, -3], {'type': 1, 'group_delay': '4'}], ['repair check: random linear phase 12', [-1, 1, -1, 1, 0, 0], {'type': 4, 'group_delay': '3/2'}], ['control: not linear phase', [1, 2, 3], {'type': None, 'group_delay': None}], ['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}], ['control: random linear phase 6', [0, 3, 2, -3], {'type': None, 'group_delay': None}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-digital_signal_filters-linear-phase-classifier-symmetric-type-parity","generated_at":"2026-09-29T14:51:38.102673+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Linear-phase type determines which responses an FIR can realize (e.g. no highpass for type 2); misclassification picks the wrong design.","repair":"Odd symmetric is type 1, even symmetric is type 2.","root_cause":"The symmetric branch maps odd N to type 2 and even N to type 1.","sha256":"21ead738058a485444eb291cf2faf8bbc11136970b45075e83dc343be3da0178","title":"Linear-phase classifier swaps types 1 and 2 · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.544,"exit_code":1,"observations":[{"actual":{"group_delay":"1","type":1},"check":"regression: type I","expected":{"group_delay":"1","type":1},"passed":true},{"actual":{"group_delay":"1/2","type":2},"check":"regression: type II","expected":{"group_delay":"1/2","type":2},"passed":true},{"actual":{"group_delay":"1","type":4},"check":"repair check: type III zero centre","expected":{"group_delay":"1","type":3},"passed":false},{"actual":{"group_delay":null,"type":null},"check":"control: type III nonzero centre","expected":{"group_delay":null,"type":null},"passed":true},{"actual":"degenerate","check":"control: all zero","expected":"degenerate","passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: not linear phase","expected":{"group_delay":null,"type":null},"passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: random linear phase 2","expected":{"group_delay":null,"type":null},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: type I\", \"actual\": {\"type\": 1, \"group_delay\": \"1\"}, \"expected\": {\"type\": 1, \"group_delay\": \"1\"}, \"passed\": true}, {\"check\": \"regression: type II\", \"actual\": {\"type\": 2, \"group_delay\": \"1/2\"}, \"expected\": {\"type\": 2, \"group_delay\": \"1/2\"}, \"passed\": true}, {\"check\": \"repair check: type III zero centre\", \"actual\": {\"type\": 4, \"group_delay\": \"1\"}, \"expected\": {\"type\": 3, \"group_delay\": \"1\"}, \"passed\": false}, {\"check\": \"control: type III nonzero centre\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: all zero\", \"actual\": \"degenerate\", \"expected\": \"degenerate\", \"passed\": true}, {\"check\": \"control: not linear phase\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: random linear phase 2\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.861,"exit_code":1,"observations":[{"actual":{"group_delay":"1","type":2},"check":"regression: type I","expected":{"group_delay":"1","type":1},"passed":false},{"actual":{"group_delay":"1/2","type":1},"check":"regression: type II","expected":{"group_delay":"1/2","type":2},"passed":false},{"actual":{"group_delay":"1","type":3},"check":"repair check: type III zero centre","expected":{"group_delay":"1","type":3},"passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: type III nonzero centre","expected":{"group_delay":null,"type":null},"passed":true},{"actual":"degenerate","check":"control: all zero","expected":"degenerate","passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: not linear phase","expected":{"group_delay":null,"type":null},"passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: random linear phase 2","expected":{"group_delay":null,"type":null},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: type I\", \"actual\": {\"type\": 2, \"group_delay\": \"1\"}, \"expected\": {\"type\": 1, \"group_delay\": \"1\"}, \"passed\": false}, {\"check\": \"regression: type II\", \"actual\": {\"type\": 1, \"group_delay\": \"1/2\"}, \"expected\": {\"type\": 2, \"group_delay\": \"1/2\"}, \"passed\": false}, {\"check\": \"repair check: type III zero centre\", \"actual\": {\"type\": 3, \"group_delay\": \"1\"}, \"expected\": {\"type\": 3, \"group_delay\": \"1\"}, \"passed\": true}, {\"check\": \"control: type III nonzero centre\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: all zero\", \"actual\": \"degenerate\", \"expected\": \"degenerate\", \"passed\": true}, {\"check\": \"control: not linear phase\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: random linear phase 2\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":44.843,"exit_code":0,"observations":[{"actual":{"group_delay":"1","type":1},"check":"regression: type I","expected":{"group_delay":"1","type":1},"passed":true},{"actual":{"group_delay":"1/2","type":2},"check":"regression: type II","expected":{"group_delay":"1/2","type":2},"passed":true},{"actual":{"group_delay":"1","type":3},"check":"repair check: type III zero centre","expected":{"group_delay":"1","type":3},"passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: type III nonzero centre","expected":{"group_delay":null,"type":null},"passed":true},{"actual":"degenerate","check":"control: all zero","expected":"degenerate","passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: not linear phase","expected":{"group_delay":null,"type":null},"passed":true},{"actual":{"group_delay":null,"type":null},"check":"control: random linear phase 2","expected":{"group_delay":null,"type":null},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: type I\", \"actual\": {\"type\": 1, \"group_delay\": \"1\"}, \"expected\": {\"type\": 1, \"group_delay\": \"1\"}, \"passed\": true}, {\"check\": \"regression: type II\", \"actual\": {\"type\": 2, \"group_delay\": \"1/2\"}, \"expected\": {\"type\": 2, \"group_delay\": \"1/2\"}, \"passed\": true}, {\"check\": \"repair check: type III zero centre\", \"actual\": {\"type\": 3, \"group_delay\": \"1\"}, \"expected\": {\"type\": 3, \"group_delay\": \"1\"}, \"passed\": true}, {\"check\": \"control: type III nonzero centre\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: all zero\", \"actual\": \"degenerate\", \"expected\": \"degenerate\", \"passed\": true}, {\"check\": \"control: not linear phase\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}, {\"check\": \"control: random linear phase 2\", \"actual\": {\"type\": null, \"group_delay\": null}, \"expected\": {\"type\": null, \"group_delay\": null}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}