FAILURE MAP
← Case archive

FA-14686 / Numerics / Open access

Lagrange interpolation value: basis accumulation · case 01

The exact lagrange interpolation value result violates the stated contract at basis accumulation.

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

ROOT CAUSE

The basis accumulation step uses term instead of ans+term.

VERIFIED REPAIR

Use ans+term at the basis accumulation step.

Unsuccessful approach: The partial repair ans-term still violates the basis accumulation invariant.

Case contract

Input [points,t] distinct integer abscissae and integer ordinates; exact rational interpolation value [p,q].

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):
    points,t=x
    ans=Fraction(0)
    for i,(xi,yi) in enumerate(points):
     term=Fraction(yi)
     for j,(xj,yj) in enumerate(points):
      if i==j:continue
      den=xi-xj
      if den==0:return None
      term*=Fraction(t-xj,den)
     ans=term
    return [ans.numerator,ans.denominator]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-2, -2], [-1, -2], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 1], [4, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 2], [10, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 3], [18, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 2]], 3], [38, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -3], [-5, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -1], [-1, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 0]], -1], [-1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 1], [1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 2], [2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], 2], [4, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 2], [14, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 3], [23, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -3], [-8, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -2], [-2, 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][-2, 1]Failed
explicit oracle 1[-2, 1][-2, 1]Passed
explicit oracle 2[3, 1][2, 1]Failed
explicit oracle 3[0, 1][-2, 1]Failed
explicit oracle 4[-2, 1][-2, 1]Passed
explicit oracle 5[-6, 1][-2, 1]Failed
explicit oracle 6[-12, 1][-2, 1]Failed
explicit oracle 7[-20, 1][-2, 1]Failed

SHA-256 / 5324bf6504ec90f6c1d6004a29d9003fde0a868216f8e25cb0468161e8210ae7

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):
    points,t=x
    ans=Fraction(0)
    for i,(xi,yi) in enumerate(points):
     term=Fraction(yi)
     for j,(xj,yj) in enumerate(points):
      if i==j:continue
      den=xi-xj
      if den==0:return None
      term*=Fraction(t-xj,den)
     ans=ans-term
    return [ans.numerator,ans.denominator]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-2, -2], [-1, -2], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 1], [4, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 2], [10, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 3], [18, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 2]], 3], [38, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -3], [-5, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -1], [-1, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 0]], -1], [-1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 1], [1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 2], [2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], 2], [4, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 2], [14, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 3], [23, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -3], [-8, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -2], [-2, 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[2, 1][-2, 1]Failed
explicit oracle 1[2, 1][-2, 1]Failed
explicit oracle 2[-2, 1][2, 1]Failed
explicit oracle 3[2, 1][-2, 1]Failed
explicit oracle 4[2, 1][-2, 1]Failed
explicit oracle 5[2, 1][-2, 1]Failed
explicit oracle 6[2, 1][-2, 1]Failed
explicit oracle 7[2, 1][-2, 1]Failed

SHA-256 / c62af3766557174fd90c716b8b7f5ef974a2cb2395291075ab994d1a933bdad4

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):
    points,t=x
    ans=Fraction(0)
    for i,(xi,yi) in enumerate(points):
     term=Fraction(yi)
     for j,(xj,yj) in enumerate(points):
      if i==j:continue
      den=xi-xj
      if den==0:return None
      term*=Fraction(t-xj,den)
     ans=ans+term
    return [ans.numerator,ans.denominator]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-2, -2], [-1, -2], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 0], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 1], [4, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 2], [10, 1]), ([[[-2, -2], [-1, -2], [0, 0]], 3], [18, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -2], [0, 2]], 3], [38, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -3], [-5, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -2], [-2, 1]), ([[[-2, -2], [-1, -1], [0, -2]], -1], [-1, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 2], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], -1], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 0]], -1], [-1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 0], [0, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 1], [1, 1]), ([[[-2, -2], [-1, -1], [0, 0]], 2], [2, 1])], [([[[-2, -2], [-1, -2], [0, -2]], 3], [-2, 1]), ([[[-2, -2], [-1, -2], [0, -1]], 2], [4, 1]), ([[[-2, -2], [-1, -2], [0, -2]], -3], [-2, 1]), ([[[0, 2], [2, 2]], 3], [2, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 2], [14, 1]), ([[[-2, -2], [-1, -1], [0, 2]], 3], [23, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -3], [-8, 1]), ([[[-2, -2], [-1, 0], [0, -2]], -2], [-2, 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[-2, 1][-2, 1]Passed
explicit oracle 1[-2, 1][-2, 1]Passed
explicit oracle 2[2, 1][2, 1]Passed
explicit oracle 3[-2, 1][-2, 1]Passed
explicit oracle 4[-2, 1][-2, 1]Passed
explicit oracle 5[-2, 1][-2, 1]Passed
explicit oracle 6[-2, 1][-2, 1]Passed
explicit oracle 7[-2, 1][-2, 1]Passed

SHA-256 / fdea7bff860738977ed99baf14adcff77c680131e2a19315984d375b2c7d091d

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

Case digest / bce355d8412e5dda4fb7cbe77039b4210cdc09e3814cd1bcdd4e15bc4e4d577e