FAILURE MAP
← Case archive

FA-91626 / Digital signal filters / Open access

SOS cascade applies the gain after the last section · case 01

With saturating stages the output differs from gain-at-input: loud inputs are no longer clipped in the first stage.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The scalar gain multiplies the cascade output instead of the input.

VERIFIED REPAIR

Scale the input before the first section.

Unsuccessful approach: The attempted repair scales at both input and output, applying the gain twice.

Case contract

Input [gain, sections, limit, samples]; each section [b0, b1, b2, a1, a2] is a direct-form-I biquad (a0 = 1) with its own state. The input is scaled by gain, each section output is clamped to [-limit, limit] and the clamped value is both stored as that section's output state and fed to the next section. Return exact fraction strings.

Why this case matters

Cascaded second-order sections with per-stage saturation model fixed-point IIR hardware; state sharing or gain staging slips change clipping.

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):
    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]
    coefs = [[Fraction(v) for v in s] for s in secs]
    states = [[Fraction(0)] * 4 for _ in coefs]
    out = []
    for v in xs:
        u = v
        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):
            st = states[k]
            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]
            y = max(-lim, min(lim, y))
            st[:] = [u, st[0], y, st[2]]
            u = y
        out.append(str(gain * u))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]
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 fixtureActualExpectedOutcome
regression: gain before saturation['3', '9/2', '21/4']['2', '2', '2']Failed
regression: three sections['5/2', '5/2', '5/2', '1/2']['3', '5', '19/4', '9/8']Failed
repair check: random cascade 0['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']Passed
control: two sections saturating['4', '4', '-3', '3']['4', '4', '-3', '3']Passed
control: random cascade 3['-2', '3/2', '-11/8', '11/32', '-11/128']['-2', '3/2', '-11/8', '11/32', '-11/128']Passed
control: random cascade 7['1', '2', '-1']['1', '2', '-1']Passed
control: random cascade 8['-3/2', '-3/4', '1/8', '-31/16', '-47/32']['-3/2', '-3/4', '1/8', '-31/16', '-47/32']Passed

SHA-256 / 22828736a0fd9a72a96e262e66466bcd2908a90fe769a965654edbc0c49af0e8

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):
    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]
    coefs = [[Fraction(v) for v in s] for s in secs]
    states = [[Fraction(0)] * 4 for _ in coefs]
    out = []
    for v in xs:
        u = gain * v
        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):
            st = states[k]
            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]
            y = max(-lim, min(lim, y))
            st[:] = [u, st[0], y, st[2]]
            u = y
        out.append(str(gain * u))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]
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 fixtureActualExpectedOutcome
regression: gain before saturation['6', '6', '6']['2', '2', '2']Failed
regression: three sections['3/2', '5/2', '19/8', '9/16']['3', '5', '19/4', '9/8']Failed
repair check: random cascade 0['3/4', '7/8', '3/4', '13/32', '-15/64', '9/32']['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']Failed
control: two sections saturating['4', '4', '-3', '3']['4', '4', '-3', '3']Passed
control: random cascade 3['-2', '3/2', '-11/8', '11/32', '-11/128']['-2', '3/2', '-11/8', '11/32', '-11/128']Passed
control: random cascade 7['1', '2', '-1']['1', '2', '-1']Passed
control: random cascade 8['-3/2', '-3/4', '1/8', '-31/16', '-47/32']['-3/2', '-3/4', '1/8', '-31/16', '-47/32']Passed

SHA-256 / 8adef47a79091a025f9bcd59e70e5c40fe00bc56ce140268f8dbbfd83c9f4c12

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]
    coefs = [[Fraction(v) for v in s] for s in secs]
    states = [[Fraction(0)] * 4 for _ in coefs]
    out = []
    for v in xs:
        u = gain * v
        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):
            st = states[k]
            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]
            y = max(-lim, min(lim, y))
            st[:] = [u, st[0], y, st[2]]
            u = y
        out.append(str(u))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]
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 fixtureActualExpectedOutcome
regression: gain before saturation['2', '2', '2']['2', '2', '2']Passed
regression: three sections['3', '5', '19/4', '9/8']['3', '5', '19/4', '9/8']Passed
repair check: random cascade 0['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']Passed
control: two sections saturating['4', '4', '-3', '3']['4', '4', '-3', '3']Passed
control: random cascade 3['-2', '3/2', '-11/8', '11/32', '-11/128']['-2', '3/2', '-11/8', '11/32', '-11/128']Passed
control: random cascade 7['1', '2', '-1']['1', '2', '-1']Passed
control: random cascade 8['-3/2', '-3/4', '1/8', '-31/16', '-47/32']['-3/2', '-3/4', '1/8', '-31/16', '-47/32']Passed

SHA-256 / 35329acf616c13378601ad8281d5ac3582da9c9678cf3f637e2d329ad800b089

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:37.626099+00:00.

Case digest / d94c0b625e9f2a7f56a1a645e0c3f542aa2200b45dbee997a70961335d122468