FAILURE MAP
← Case archive

FA-14621 / Numerics / Open access

Polynomial composition: horner traversal · case 01

The exact polynomial composition result violates the stated contract at horner traversal.

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

ROOT CAUSE

The horner traversal step uses A instead of reversed(A).

VERIFIED REPAIR

Use reversed(A) at the horner traversal step.

Unsuccessful approach: The partial repair reversed(A[1:]) still violates the horner traversal 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 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, 0], [-1, -1]], [0, 1]), ([[-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, 0], [-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, 0], [0, -1]], [-1, 1]), ([[-1, -1, -1], [1, 0]], [-3]), ([[-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, 0], [0, 0]], [-1]), ([[-1, -1, 0], [-1, 0]], [0]), ([[-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, 0], [0, 1]], [-1, -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]), ([[-1, 1, 1], [-1, -1]], [-1, 1, 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[0, -1, -1][0, 1]Failed
explicit oracle 1[-1, -1, -1][-1, -1, -1]Passed
explicit oracle 2[0][0]Passed
explicit oracle 3[-1][-1]Passed
explicit oracle 4[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 5[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 6[-1][-1]Passed
explicit oracle 7[-1, -1, -1][-1, -1, -1]Passed

SHA-256 / 8a2e62d06755c39407e8fdfa2c7e51f3e4439d47bcb4e2fa8d0dfa51fe6c979b

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[1:]):
     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, 0], [-1, -1]], [0, 1]), ([[-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, 0], [-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, 0], [0, -1]], [-1, 1]), ([[-1, -1, -1], [1, 0]], [-3]), ([[-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, 0], [0, 0]], [-1]), ([[-1, -1, 0], [-1, 0]], [0]), ([[-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, 0], [0, 1]], [-1, -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]), ([[-1, 1, 1], [-1, -1]], [-1, 1, 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][0, 1]Failed
explicit oracle 1[0, 1][-1, -1, -1]Failed
explicit oracle 2[0][0]Passed
explicit oracle 3[0][-1]Failed
explicit oracle 4[0, -1][-1, 1, -1]Failed
explicit oracle 5[-1, 1][-1, 1, -1]Failed
explicit oracle 6[-1][-1]Passed
explicit oracle 7[-1, -1][-1, -1, -1]Failed

SHA-256 / 2586dff5a44080066a566267ca76300cfa4679a138a1828dbda24ee70d1191f6

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, 0], [-1, -1]], [0, 1]), ([[-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, 0], [-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, 0], [0, -1]], [-1, 1]), ([[-1, -1, -1], [1, 0]], [-3]), ([[-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, 0], [0, 0]], [-1]), ([[-1, -1, 0], [-1, 0]], [0]), ([[-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, 0], [0, 1]], [-1, -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]), ([[-1, 1, 1], [-1, -1]], [-1, 1, 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[0, 1][0, 1]Passed
explicit oracle 1[-1, -1, -1][-1, -1, -1]Passed
explicit oracle 2[0][0]Passed
explicit oracle 3[-1][-1]Passed
explicit oracle 4[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 5[-1, 1, -1][-1, 1, -1]Passed
explicit oracle 6[-1][-1]Passed
explicit oracle 7[-1, -1, -1][-1, -1, -1]Passed

SHA-256 / e989afe4eae999f0b5d39ffd49c05a1a2fb60cd8d696cd5fbb7804aaae16c4a3

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

Case digest / cac6d316aaa849df7e8bebaae579bef1f310c8bc6599c49391ee9a1fabc8c014