FAILURE MAP
← Case archive

FA-15476 / Numerics / Open access

Integer matrix binary power: selected power accumulation · case 01

The exact integer matrix binary power result violates the stated contract at selected power accumulation.

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

ROOT CAUSE

The selected power accumulation step uses a instead of mul(r,a).

VERIFIED REPAIR

Use mul(r,a) at the selected power accumulation step.

Unsuccessful approach: The partial repair mul(r,r) still violates the selected power accumulation invariant.

Case contract

Input [square integer matrix,nonnegative exponent<=12]; return exact matrix power.

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,e=x;n=len(a)
    def mul(a,b):return [[sum(a[i][k]*b[k][j] for k in range(n)) for j in range(n)] for i in range(n)]
    r=[[int(i==j) for j in range(n)] for i in range(n)]
    for _ in range(12):
     if e==0:break
     if e%2==1:r=a
     a=mul(a,a)
     e=e//2
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-1]], 3], [[-1]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 2], [[1]]), ([[[-1]], 4], [[1]]), ([[[-1]], 5], [[-1]]), ([[[-1]], 6], [[1]])], [([[[-1]], 5], [[-1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[-1]], 7], [[-1]]), ([[[2]], 3], [[8]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[1]], 7], [[1]]), ([[[1]], 8], [[1]]), ([[[3]], 0], [[1]]), ([[[3]], 1], [[3]])], [([[[2]], 3], [[8]]), ([[[2]], 6], [[64]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 6], [[1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 8], [[1]]), ([[[3]], 0], [[1]])], [([[[2]], 5], [[32]]), ([[[2]], 1], [[2]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-3]], 5], [[-243]]), ([[[-3]], 6], [[729]]), ([[[-3]], 7], [[-2187]]), ([[[-3]], 8], [[6561]])]]
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[[1]][[-1]]Failed
explicit oracle 1[[-1]][[-1]]Passed
explicit oracle 2[[1]][[1]]Passed
explicit oracle 3[[1168, 2688], [-896, -624]][[1168, 2688], [-896, -624]]Passed
explicit oracle 4[[1]][[1]]Passed
explicit oracle 5[[1]][[1]]Passed
explicit oracle 6[[1]][[-1]]Failed
explicit oracle 7[[1]][[1]]Passed

SHA-256 / 353110941204fffedb43df71dc3ae201481927ace0b0582941edec3f1b425e2f

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,e=x;n=len(a)
    def mul(a,b):return [[sum(a[i][k]*b[k][j] for k in range(n)) for j in range(n)] for i in range(n)]
    r=[[int(i==j) for j in range(n)] for i in range(n)]
    for _ in range(12):
     if e==0:break
     if e%2==1:r=mul(r,r)
     a=mul(a,a)
     e=e//2
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-1]], 3], [[-1]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 2], [[1]]), ([[[-1]], 4], [[1]]), ([[[-1]], 5], [[-1]]), ([[[-1]], 6], [[1]])], [([[[-1]], 5], [[-1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[-1]], 7], [[-1]]), ([[[2]], 3], [[8]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[1]], 7], [[1]]), ([[[1]], 8], [[1]]), ([[[3]], 0], [[1]]), ([[[3]], 1], [[3]])], [([[[2]], 3], [[8]]), ([[[2]], 6], [[64]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 6], [[1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 8], [[1]]), ([[[3]], 0], [[1]])], [([[[2]], 5], [[32]]), ([[[2]], 1], [[2]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-3]], 5], [[-243]]), ([[[-3]], 6], [[729]]), ([[[-3]], 7], [[-2187]]), ([[[-3]], 8], [[6561]])]]
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[[1]][[-1]]Failed
explicit oracle 1[[1]][[-1]]Failed
explicit oracle 2[[1]][[1]]Passed
explicit oracle 3[[1, 0], [0, 1]][[1168, 2688], [-896, -624]]Failed
explicit oracle 4[[1]][[1]]Passed
explicit oracle 5[[1]][[1]]Passed
explicit oracle 6[[1]][[-1]]Failed
explicit oracle 7[[1]][[1]]Passed

SHA-256 / eaf2b37ff5d133deaf75040102a6578daa3321641fabb3ab27589dafd57300e7

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,e=x;n=len(a)
    def mul(a,b):return [[sum(a[i][k]*b[k][j] for k in range(n)) for j in range(n)] for i in range(n)]
    r=[[int(i==j) for j in range(n)] for i in range(n)]
    for _ in range(12):
     if e==0:break
     if e%2==1:r=mul(r,a)
     a=mul(a,a)
     e=e//2
    return r
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[-1]], 3], [[-1]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 2], [[1]]), ([[[-1]], 4], [[1]]), ([[[-1]], 5], [[-1]]), ([[[-1]], 6], [[1]])], [([[[-1]], 5], [[-1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[-1]], 7], [[-1]]), ([[[2]], 3], [[8]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[1]], 7], [[1]]), ([[[1]], 8], [[1]]), ([[[3]], 0], [[1]]), ([[[3]], 1], [[3]])], [([[[2]], 3], [[8]]), ([[[2]], 6], [[64]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 6], [[1]]), ([[[-1]], 7], [[-1]]), ([[[-1]], 8], [[1]]), ([[[3]], 0], [[1]])], [([[[2]], 5], [[32]]), ([[[2]], 1], [[2]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-3]], 5], [[-243]]), ([[[-3]], 6], [[729]]), ([[[-3]], 7], [[-2187]]), ([[[-3]], 8], [[6561]])]]
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[[-1]][[-1]]Passed
explicit oracle 1[[-1]][[-1]]Passed
explicit oracle 2[[1]][[1]]Passed
explicit oracle 3[[1168, 2688], [-896, -624]][[1168, 2688], [-896, -624]]Passed
explicit oracle 4[[1]][[1]]Passed
explicit oracle 5[[1]][[1]]Passed
explicit oracle 6[[-1]][[-1]]Passed
explicit oracle 7[[1]][[1]]Passed

SHA-256 / b42c77bb2402a7e5b2bea6bd880abf5c52459c9a5be95ec96c469a5abaa58e98

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

Case digest / ce7f86ac62ea226e78280e06c269893ecad19e8d84a7bbed9185feef9c7aed4e