FAILURE MAP
← Case archive

FA-15361 / Numerics / Open access

Bareiss determinant: previous pivot divisor · case 01

The exact bareiss determinant result violates the stated contract at previous pivot divisor.

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

ROOT CAUSE

The previous pivot divisor step uses 1 instead of a[k][k].

THE FAILURE

The previous pivot divisor step uses 1 instead of a[k][k].

Unsuccessful approach: The partial repair abs(a[k][k]) still violates the previous pivot divisor invariant.

Case contract

Input nonempty square integer matrix; return exact determinant using pivoted fraction-free elimination.

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=[r[:] for r in x];n=len(a);prev=1;sign=1
    for k in range(n-1):
     pivot=next((i for i in range(k,n) if a[i][k]!=0),None)
     if pivot is None:return 0
     if pivot!=k:
      a[k],a[pivot]=a[pivot],a[k]
      sign=-sign
     for i in range(k+1,n):
      for j in range(k+1,n):a[i][j]=(a[i][j]*a[k][k]-a[i][k]*a[k][j])//prev
     prev=1
     if not prev:return None
     for i in range(k+1,n):a[i][k]=0
    return sign*a[-1][-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-3, -3, 1], [-2, -1, -2], [-1, -3, 0]], 17), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[2]], 2), ([[2]], 2), ([[1]], 1), ([[3]], 3), ([[-1]], -1)], [([[0, -3, -2], [-1, -2, 0], [-3, 0, -2]], 18), ([[-1, -2, 2], [-1, 0, 2], [-2, 0, 3]], 2), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[-3]], -3), ([[1]], 1), ([[3]], 3), ([[2]], 2)], [([[-3, -1, 1], [1, 2, 3], [3, -3, -2]], -35), ([[-3, -1, 0], [0, -3, 2], [-1, 0, -3]], -25), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[3]], 3), ([[-2]], -2), ([[-1]], -1), ([[-3]], -3)], [([[-1, -2, 2], [-1, 0, 2], [-2, 0, 3]], 2), ([[-2, 1, 0], [3, 0, 3], [-3, 2, -2]], 9), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[2]], 2), ([[-2]], -2), ([[2]], 2), ([[2]], 2)], [([[-2, 0, 2], [-2, 3, 2], [3, -2, 2]], -30), ([[-2, 1, 3], [-2, 2, -2], [-3, 1, -3]], 20), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[-1, 0], [-3, -2]], 2), ([[0, 3], [0, -3]], 0), ([[-1, 0], [1, 2]], -2), ([[-2, 0], [-2, 0]], 0)]]
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-5117Failed
explicit oracle 1-1-1Passed
explicit oracle 2-164Failed
explicit oracle 322Passed
explicit oracle 422Passed
explicit oracle 511Passed
explicit oracle 633Passed
explicit oracle 7-1-1Passed

SHA-256 / 02070d40cc9240125b6c1c4d399a699c67a3c9a2afbc29afb52ab60d66b29c8a

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=[r[:] for r in x];n=len(a);prev=1;sign=1
    for k in range(n-1):
     pivot=next((i for i in range(k,n) if a[i][k]!=0),None)
     if pivot is None:return 0
     if pivot!=k:
      a[k],a[pivot]=a[pivot],a[k]
      sign=-sign
     for i in range(k+1,n):
      for j in range(k+1,n):a[i][j]=(a[i][j]*a[k][k]-a[i][k]*a[k][j])//prev
     prev=abs(a[k][k])
     if not prev:return None
     for i in range(k+1,n):a[i][k]=0
    return sign*a[-1][-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-3, -3, 1], [-2, -1, -2], [-1, -3, 0]], 17), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[2]], 2), ([[2]], 2), ([[1]], 1), ([[3]], 3), ([[-1]], -1)], [([[0, -3, -2], [-1, -2, 0], [-3, 0, -2]], 18), ([[-1, -2, 2], [-1, 0, 2], [-2, 0, 3]], 2), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[-3]], -3), ([[1]], 1), ([[3]], 3), ([[2]], 2)], [([[-3, -1, 1], [1, 2, 3], [3, -3, -2]], -35), ([[-3, -1, 0], [0, -3, 2], [-1, 0, -3]], -25), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[3]], 3), ([[-2]], -2), ([[-1]], -1), ([[-3]], -3)], [([[-1, -2, 2], [-1, 0, 2], [-2, 0, 3]], 2), ([[-2, 1, 0], [3, 0, 3], [-3, 2, -2]], 9), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[2]], 2), ([[-2]], -2), ([[2]], 2), ([[2]], 2)], [([[-2, 0, 2], [-2, 3, 2], [3, -2, 2]], -30), ([[-2, 1, 3], [-2, 2, -2], [-3, 1, -3]], 20), ([[-1]], -1), ([[-1, -1, 0, 3], [-3, 1, -2, 2], [0, -1, 1, 2], [-3, 2, -3, -2]], 4), ([[-1, 0], [-3, -2]], 2), ([[0, 3], [0, -3]], 0), ([[-1, 0], [1, 2]], -2), ([[-2, 0], [-2, 0]], 0)]]
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-1717Failed
explicit oracle 1-1-1Passed
explicit oracle 2-44Failed
explicit oracle 322Passed
explicit oracle 422Passed
explicit oracle 511Passed
explicit oracle 633Passed
explicit oracle 7-1-1Passed

SHA-256 / 06cbb99ba8be6daacb8c5c8fd1f13caf51c0071a52124524e532fbc6a92618b2

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 60c6eaedf50e81c27badf562a56d7eecdd32ca2b163ac19a16d0926596e70703