FAILURE MAP
← Case archive

FA-14636 / Numerics / Open access

Polynomial composition: canonical degree · case 01

The exact polynomial composition result violates the stated contract at canonical degree.

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

ROOT CAUSE

The canonical degree step uses r[0]==0 instead of r[-1]==0.

VERIFIED REPAIR

Use r[-1]==0 at the canonical degree step.

Unsuccessful approach: The partial repair r[-1]<=0 still violates the canonical degree invariant.

Case contract

Input [A,B] nonempty ascending integer polynomials; return canonical ascending coefficients A(B(t)), zero represented [0].

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    A,B=x
    r=[0]
    for a in reversed(A):
     t=[0]*(len(r)+len(B)-1)
     for i,u in enumerate(r):
      for j,v in enumerate(B):
       if i+j>=len(t):return None
       t[i+j]+=u*v
     t[0]+=a
     r=t
    while len(r)>1 and r[0]==0:r.pop()
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, -1, -1], [0, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [1, -1]], [-3, 3, -1])], [([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, 0], [1, 1]], [-2, -1]), ([[-1, -1, 1], [-1, -1]], [1, 3, 1]), ([[-1, -1, 1], [-1, 0]], [1]), ([[-1, -1, 1], [-1, 1]], [1, -3, 1])], [([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, 0], [-1, 1]], [0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, -1], [1, 0]], [-2]), ([[-1, 0, -1], [1, 1]], [-2, -2, -1]), ([[-1, 0, 0], [-1, -1]], [-1]), ([[-1, 0, 0], [-1, 0]], [-1])], [([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, 0, -1], [-1, -1]], [-2, -2, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, 1], [1, -1]], [0, -2, 1]), ([[-1, 0, 1], [1, 0]], [0]), ([[-1, 0, 1], [1, 1]], [0, 2, 1]), ([[-1, 1, -1], [-1, -1]], [-3, -3, -1])], [([[-1, -1, -1], [0, 0]], [-1]), ([[-1, 0, -1], [0, 1]], [-1, 0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 1, 0], [0, 1]], [-1, 1]), ([[-1, 1, 0], [1, -1]], [0, -1]), ([[-1, 1, 0], [1, 0]], [0]), ([[-1, 1, 0], [1, 1]], [0, 1])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 0[-1, -1, -1, 0][-1, -1, -1]Failed
explicit oracle 1[0][0]Passed
explicit oracle 2[-1, 0, 0, 0][-1]Failed
explicit oracle 3[-1, 1, -1, 0][-1, 1, -1]Failed
explicit oracle 4[-1, 1, -1, 0][-1, 1, -1]Failed
explicit oracle 5[-1, 0, 0, 0][-1]Failed
explicit oracle 6[-1, -1, -1, 0][-1, -1, -1]Failed
explicit oracle 7[-3, 3, -1, 0][-3, 3, -1]Failed

SHA-256 / 94c522056f0c18b04e0bf460c774b1452f8efa269aba03a8fa4c016330d96513

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    A,B=x
    r=[0]
    for a in reversed(A):
     t=[0]*(len(r)+len(B)-1)
     for i,u in enumerate(r):
      for j,v in enumerate(B):
       if i+j>=len(t):return None
       t[i+j]+=u*v
     t[0]+=a
     r=t
    while len(r)>1 and r[-1]<=0:r.pop()
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, -1, -1], [0, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [1, -1]], [-3, 3, -1])], [([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, 0], [1, 1]], [-2, -1]), ([[-1, -1, 1], [-1, -1]], [1, 3, 1]), ([[-1, -1, 1], [-1, 0]], [1]), ([[-1, -1, 1], [-1, 1]], [1, -3, 1])], [([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, 0], [-1, 1]], [0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, -1], [1, 0]], [-2]), ([[-1, 0, -1], [1, 1]], [-2, -2, -1]), ([[-1, 0, 0], [-1, -1]], [-1]), ([[-1, 0, 0], [-1, 0]], [-1])], [([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, 0, -1], [-1, -1]], [-2, -2, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, 1], [1, -1]], [0, -2, 1]), ([[-1, 0, 1], [1, 0]], [0]), ([[-1, 0, 1], [1, 1]], [0, 2, 1]), ([[-1, 1, -1], [-1, -1]], [-3, -3, -1])], [([[-1, -1, -1], [0, 0]], [-1]), ([[-1, 0, -1], [0, 1]], [-1, 0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 1, 0], [0, 1]], [-1, 1]), ([[-1, 1, 0], [1, -1]], [0, -1]), ([[-1, 1, 0], [1, 0]], [0]), ([[-1, 1, 0], [1, 1]], [0, 1])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 0[-1][-1, -1, -1]Failed
explicit oracle 1[0][0]Passed
explicit oracle 2[-1][-1]Passed
explicit oracle 3[-1, 1][-1, 1, -1]Failed
explicit oracle 4[-1, 1][-1, 1, -1]Failed
explicit oracle 5[-1][-1]Passed
explicit oracle 6[-1][-1, -1, -1]Failed
explicit oracle 7[-3, 3][-3, 3, -1]Failed

SHA-256 / e054219a640f562f800b105a9bd5445ff9f4e390bce90511aefda7359c3037b1

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    A,B=x
    r=[0]
    for a in reversed(A):
     t=[0]*(len(r)+len(B)-1)
     for i,u in enumerate(r):
      for j,v in enumerate(B):
       if i+j>=len(t):return None
       t[i+j]+=u*v
     t[0]+=a
     r=t
    while len(r)>1 and r[-1]==0:r.pop()
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, -1, -1], [0, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [1, -1]], [-3, 3, -1])], [([[-1, -1, -1], [-1, 0]], [-1]), ([[-1, -1, -1], [0, 1]], [-1, -1, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, -1, 0], [1, 1]], [-2, -1]), ([[-1, -1, 1], [-1, -1]], [1, 3, 1]), ([[-1, -1, 1], [-1, 0]], [1]), ([[-1, -1, 1], [-1, 1]], [1, -3, 1])], [([[-1, -1, -1], [-1, 1]], [-1, 1, -1]), ([[-1, -1, 0], [-1, 1]], [0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, -1], [1, 0]], [-2]), ([[-1, 0, -1], [1, 1]], [-2, -2, -1]), ([[-1, 0, 0], [-1, -1]], [-1]), ([[-1, 0, 0], [-1, 0]], [-1])], [([[-1, -1, -1], [0, -1]], [-1, 1, -1]), ([[-1, 0, -1], [-1, -1]], [-2, -2, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 0, 1], [1, -1]], [0, -2, 1]), ([[-1, 0, 1], [1, 0]], [0]), ([[-1, 0, 1], [1, 1]], [0, 2, 1]), ([[-1, 1, -1], [-1, -1]], [-3, -3, -1])], [([[-1, -1, -1], [0, 0]], [-1]), ([[-1, 0, -1], [0, 1]], [-1, 0, -1]), ([[-1, -1, -1], [-1, -1]], [-1, -1, -1]), ([[0, 0], [1, 1]], [0]), ([[-1, 1, 0], [0, 1]], [-1, 1]), ([[-1, 1, 0], [1, -1]], [0, -1]), ([[-1, 1, 0], [1, 0]], [0]), ([[-1, 1, 0], [1, 1]], [0, 1])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 0[-1, -1, -1][-1, -1, -1]Passed
explicit oracle 1[0][0]Passed
explicit oracle 2[-1][-1]Passed
explicit oracle 3[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 4[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 5[-1][-1]Passed
explicit oracle 6[-1, -1, -1][-1, -1, -1]Passed
explicit oracle 7[-3, 3, -1][-3, 3, -1]Passed

SHA-256 / 89bc4bfb16f1fa64d5b3cf03e22165d42371cd157019f3e4ad2ecc5b74a5544b

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:39:18.932051+00:00.

Case digest / bd33699b5b6ba2ab1f8bb7186a43e5d1c5dc98b0e77bc763d28a296545d63da3