FAILURE MAP
← Case archive

FA-6121 / Polynomial arithmetic / Open access

Polynomial add unequal degree · case 01

Zipping stops at the shorter degree and loses coefficients.

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

ROOT CAUSE

Zipping stops at the shorter degree and loses coefficients.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [sum(pair) for pair in itertools.zip_longest(a,b,fillvalue=0)]

Unsuccessful approach: Concatenation shifts powers instead of combining equal degrees.

Case contract

Integer coefficients in ascending power order and integer evaluation bounds; missing high-degree coefficients are zero. Rational outputs are reduced Fraction strings; the zero-polynomial degree is -1. Polynomial add unequal degree. Exact operational definition: [sum(pair) for pair in itertools.zip_longest(a,b,fillvalue=0)]

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Polynomial arithmetic results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return [x+y for x,y in zip(a,b)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [4])', solve(*([1, 2, 3], [4])), [5, 2, 3])
check('fixture 2: ([], [2, 3])', solve(*([], [2, 3])), [2, 3])
check('fixture 3: ([1], [2, 3])', solve(*([1], [2, 3])), [3, 3])
check('fixture 4: ([], [])', solve(*([], [])), [])
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
fixture 1: ([1, 2, 3], [4])[5][5, 2, 3]Failed
fixture 2: ([], [2, 3])[][2, 3]Failed
fixture 3: ([1], [2, 3])[3][3, 3]Failed
fixture 4: ([], [])[][]Passed

SHA-256 / 075d40fec6b8b3c535edb349528356bbeb6142a79b6bbdf87f1a0d7384e07f91

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return a+b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [4])', solve(*([1, 2, 3], [4])), [5, 2, 3])
check('fixture 2: ([], [2, 3])', solve(*([], [2, 3])), [2, 3])
check('fixture 3: ([1], [2, 3])', solve(*([1], [2, 3])), [3, 3])
check('fixture 4: ([], [])', solve(*([], [])), [])
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
fixture 1: ([1, 2, 3], [4])[1, 2, 3, 4][5, 2, 3]Failed
fixture 2: ([], [2, 3])[2, 3][2, 3]Passed
fixture 3: ([1], [2, 3])[1, 2, 3][3, 3]Failed
fixture 4: ([], [])[][]Passed

SHA-256 / 8153b4432ab26459ce1360b8b8aa40bdaef4353e02d93b3230700e9aa9546cb3

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(a, b):
    return [sum(pair) for pair in itertools.zip_longest(a,b,fillvalue=0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [4])', solve(*([1, 2, 3], [4])), [5, 2, 3])
check('fixture 2: ([], [2, 3])', solve(*([], [2, 3])), [2, 3])
check('fixture 3: ([1], [2, 3])', solve(*([1], [2, 3])), [3, 3])
check('fixture 4: ([], [])', solve(*([], [])), [])
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
fixture 1: ([1, 2, 3], [4])[5, 2, 3][5, 2, 3]Passed
fixture 2: ([], [2, 3])[2, 3][2, 3]Passed
fixture 3: ([1], [2, 3])[3, 3][3, 3]Passed
fixture 4: ([], [])[][]Passed

SHA-256 / 793ce11498b791020db535caa59bc84f62b76e927839208ed249ba3a192e793d

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

Case digest / 096a37efec52b05c35bdfb65140fba6ce9f6f66443f2be3d1278bade737c7c00