FAILURE MAP
← Case archive

FA-15351 / Numerics / Open access

Bareiss determinant: row interchange parity · case 01

The exact bareiss determinant result violates the stated contract at row interchange parity.

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

ROOT CAUSE

The row interchange parity step uses sign instead of -sign.

THE FAILURE

The row interchange parity step uses sign instead of -sign.

Unsuccessful approach: The partial repair -1 still violates the row interchange parity 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=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 = [[([[0, -3], [1, -2]], 3), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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)], [([[0, 1], [2, 0]], -2), ([[-2, -2, -2, 2], [0, 0, 0, 3], [-3, -1, 0, -2], [3, -3, 2, 1]], -96), ([[-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)], [([[0, 1], [3, 3]], -3), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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)], [([[0, -3], [2, 1]], 6), ([[-2, -2, -2, 2], [0, 0, 0, 3], [-3, -1, 0, -2], [3, -3, 2, 1]], -96), ([[-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)], [([[0, 2], [3, 3]], -6), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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-33Failed
explicit oracle 1-2-2Passed
explicit oracle 2-1-1Passed
explicit oracle 344Passed
explicit oracle 422Passed
explicit oracle 522Passed
explicit oracle 611Passed
explicit oracle 733Passed

SHA-256 / 8c8b6a42f8b67b26f8788fef2f74a688b48fa9e78ccd88c5f2d44e9d1432b19c

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=-1
     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 = [[([[0, -3], [1, -2]], 3), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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)], [([[0, 1], [2, 0]], -2), ([[-2, -2, -2, 2], [0, 0, 0, 3], [-3, -1, 0, -2], [3, -3, 2, 1]], -96), ([[-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)], [([[0, 1], [3, 3]], -3), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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)], [([[0, -3], [2, 1]], 6), ([[-2, -2, -2, 2], [0, 0, 0, 3], [-3, -1, 0, -2], [3, -3, 2, 1]], -96), ([[-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)], [([[0, 2], [3, 3]], -6), ([[0, 0, -2], [-2, 3, 0], [1, -2, 0]], -2), ([[-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 033Passed
explicit oracle 12-2Failed
explicit oracle 2-1-1Passed
explicit oracle 344Passed
explicit oracle 422Passed
explicit oracle 522Passed
explicit oracle 611Passed
explicit oracle 733Passed

SHA-256 / 815c644afe6cd123419a7720402b29dd67a3a32810c2b4c7d76ac090f3c28790

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

Case digest / 720e1d590f559affab9f7dbd8d3ccc71be5337d7d1dcb032ae5679b1625f04bd