FAILURE MAP
← Case archive

FA-6076 / Linear algebra / Open access

Matrix diagonal predicate · case 01

Nonzero diagonal entries do not constrain off-diagonal entries.

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

ROOT CAUSE

Nonzero diagonal entries do not constrain off-diagonal entries.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return all(i==j or m[i][j]==0 for i in range(len(m)) for j in range(len(m)))

Unsuccessful approach: Only one triangular half is tested.

Case contract

Integer matrix/vector entries, rectangular rows, compatible multiplication dimensions, and square matrices for determinant, trace, inverse, symmetry and characteristic-polynomial operations. Rational matrix outputs are reduced Fraction strings. Matrix diagonal predicate. Exact operational definition: all(i==j or m[i][j]==0 for i in range(len(m)) for j in range(len(m)))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Linear algebra results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(m):
    return all(m[i][i]!=0 for i in range(len(m)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [0, 3]],)', solve(*([[1, 2], [0, 3]],)), False)
check('fixture 2: ([[0, 0], [0, 0]],)', solve(*([[0, 0], [0, 0]],)), True)
check('fixture 3: ([[2, 0], [0, 3]],)', solve(*([[2, 0], [0, 3]],)), True)
check('fixture 4: ([[1, 0], [2, 3]],)', solve(*([[1, 0], [2, 3]],)), False)
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
fixture 1: ([[1, 2], [0, 3]],)TrueFalseFailed
fixture 2: ([[0, 0], [0, 0]],)FalseTrueFailed
fixture 3: ([[2, 0], [0, 3]],)TrueTruePassed
fixture 4: ([[1, 0], [2, 3]],)TrueFalseFailed

SHA-256 / 3cdf1ae3778016699f81cf54b012961f33dbe08e5c0b4e677189d5ceadf52121

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(m):
    return all(m[i][j]==0 for i in range(len(m)) for j in range(i))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [0, 3]],)', solve(*([[1, 2], [0, 3]],)), False)
check('fixture 2: ([[0, 0], [0, 0]],)', solve(*([[0, 0], [0, 0]],)), True)
check('fixture 3: ([[2, 0], [0, 3]],)', solve(*([[2, 0], [0, 3]],)), True)
check('fixture 4: ([[1, 0], [2, 3]],)', solve(*([[1, 0], [2, 3]],)), False)
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
fixture 1: ([[1, 2], [0, 3]],)TrueFalseFailed
fixture 2: ([[0, 0], [0, 0]],)TrueTruePassed
fixture 3: ([[2, 0], [0, 3]],)TrueTruePassed
fixture 4: ([[1, 0], [2, 3]],)FalseFalsePassed

SHA-256 / 968f5c8ee1e45b629794902d5f053e8cef3c8dcd47b546c07240c4f2a61859ed

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(m):
    return all(i==j or m[i][j]==0 for i in range(len(m)) for j in range(len(m)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([[1, 2], [0, 3]],)', solve(*([[1, 2], [0, 3]],)), False)
check('fixture 2: ([[0, 0], [0, 0]],)', solve(*([[0, 0], [0, 0]],)), True)
check('fixture 3: ([[2, 0], [0, 3]],)', solve(*([[2, 0], [0, 3]],)), True)
check('fixture 4: ([[1, 0], [2, 3]],)', solve(*([[1, 0], [2, 3]],)), False)
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
fixture 1: ([[1, 2], [0, 3]],)FalseFalsePassed
fixture 2: ([[0, 0], [0, 0]],)TrueTruePassed
fixture 3: ([[2, 0], [0, 3]],)TrueTruePassed
fixture 4: ([[1, 0], [2, 3]],)FalseFalsePassed

SHA-256 / 7c44e0c24fe3ddf6b8ab8eaca0a1fcf2d002421cd5020a8bfc6e4531f78addaf

Verification & scope

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

Case digest / bd76dc1b1f7f59003f727a13bf6e9df61b397ee6a711641e3089022d1564352e