FA-15356 / Numerics / Open access
Bareiss determinant: fraction free cross product · case 01
The exact bareiss determinant result violates the stated contract at fraction free cross product.
ROOT CAUSE
The fraction free cross product step uses a[i][j]-a[i][k]*a[k][j] instead of a[i][j]*a[k][k]-a[i][k]*a[k][j].
VERIFIED REPAIR
Use a[i][j]*a[k][k]-a[i][k]*a[k][j] at the fraction free cross product step.
Unsuccessful approach: The partial repair a[i][j]*a[k][k]+a[i][k]*a[k][j] still violates the fraction free cross product 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[i][k]*a[k][j])//prev
prev=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 = [[([[2, 2], [2, -2]], -8), ([[2, 1], [3, 0]], -3), ([[-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)], [([[-3, 2], [2, -1]], -1), ([[-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), ([[2]], 2)], [([[-2, 3], [-3, 2]], 5), ([[-2, 2], [-3, -1]], 8), ([[-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)], [([[3, -1], [2, 3]], 11), ([[-2, 2], [-3, 1]], 4), ([[-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, 2], [-3, -1]], 8), ([[-2, -3], [-1, 2]], -7), ([[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | -6 | -8 | Failed |
| explicit oracle 1 | -3 | -3 | Passed |
| explicit oracle 2 | -1 | -1 | Passed |
| explicit oracle 3 | -24 | 4 | Failed |
| explicit oracle 4 | 2 | 2 | Passed |
| explicit oracle 5 | 2 | 2 | Passed |
| explicit oracle 6 | 1 | 1 | Passed |
| explicit oracle 7 | 3 | 3 | Passed |
SHA-256 / f0455321e2c5c7ef0527b9b6f424210549f8ceb37f5dc5b3b7a8718b622cf3c6
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=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 = [[([[2, 2], [2, -2]], -8), ([[2, 1], [3, 0]], -3), ([[-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)], [([[-3, 2], [2, -1]], -1), ([[-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), ([[2]], 2)], [([[-2, 3], [-3, 2]], 5), ([[-2, 2], [-3, -1]], 8), ([[-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)], [([[3, -1], [2, 3]], 11), ([[-2, 2], [-3, 1]], 4), ([[-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, 2], [-3, -1]], 8), ([[-2, -3], [-1, 2]], -7), ([[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | 0 | -8 | Failed |
| explicit oracle 1 | 3 | -3 | Failed |
| explicit oracle 2 | -1 | -1 | Passed |
| explicit oracle 3 | 60 | 4 | Failed |
| explicit oracle 4 | 2 | 2 | Passed |
| explicit oracle 5 | 2 | 2 | Passed |
| explicit oracle 6 | 1 | 1 | Passed |
| explicit oracle 7 | 3 | 3 | Passed |
SHA-256 / 5851a0b64656e4e96dc42402a4f34c44cb152524d08decc883e2c6b8f2d29386
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=[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=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 = [[([[2, 2], [2, -2]], -8), ([[2, 1], [3, 0]], -3), ([[-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)], [([[-3, 2], [2, -1]], -1), ([[-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), ([[2]], 2)], [([[-2, 3], [-3, 2]], 5), ([[-2, 2], [-3, -1]], 8), ([[-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)], [([[3, -1], [2, 3]], 11), ([[-2, 2], [-3, 1]], 4), ([[-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, 2], [-3, -1]], 8), ([[-2, -3], [-1, 2]], -7), ([[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | -8 | -8 | Passed |
| explicit oracle 1 | -3 | -3 | Passed |
| explicit oracle 2 | -1 | -1 | Passed |
| explicit oracle 3 | 4 | 4 | Passed |
| explicit oracle 4 | 2 | 2 | Passed |
| explicit oracle 5 | 2 | 2 | Passed |
| explicit oracle 6 | 1 | 1 | Passed |
| explicit oracle 7 | 3 | 3 | Passed |
SHA-256 / 74601e49a80a15b2b07aee00f1b3acb81c7ab8f699419173a8e991702399718e
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.013910+00:00.
Case digest / 96a4afaaac5ec1f4d719a1a6a7d42febb926cfb8e65737a29610e39bc5d677c4