FA-15486 / Numerics / Open access
Integer matrix binary power: binary exponent advancement · case 01
The exact integer matrix binary power result violates the stated contract at binary exponent advancement.
ROOT CAUSE
The binary exponent advancement step uses e-1 instead of e//2.
VERIFIED REPAIR
Use e//2 at the binary exponent advancement step.
Unsuccessful approach: The partial repair max(0,e//2-1) still violates the binary exponent advancement 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=mul(r,a)
a=mul(a,a)
e=e-1
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[2]], 3], [[8]]), ([[[2]], 2], [[4]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 2], [[1]]), ([[[-1]], 3], [[-1]]), ([[[-1]], 4], [[1]])], [([[[2]], 4], [[16]]), ([[[2]], 5], [[32]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[2]], 5], [[32]]), ([[[2]], 8], [[256]]), ([[[-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]], 6], [[64]]), ([[[2]], 4], [[16]]), ([[[-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]], 7], [[128]]), ([[[2]], 7], [[128]]), ([[[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[32]] | [[8]] | Failed |
| explicit oracle 1 | [[4]] | [[4]] | Passed |
| explicit oracle 2 | [[1]] | [[1]] | Passed |
| explicit oracle 3 | [[6256196587737406625340539501828006752895218385122505372842590208, 2412911959431560330688592206164778849117792512395106255210689855488], [-804303986477186776896197402054926283039264170798368751736896618496, -1602351776366636147167054264608024559325633123211614998100950646784]] | [[1168, 2688], [-896, -624]] | Failed |
| 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 / 3afd6c138c2db9e57a9d21a9c8f35626bc30a8284b945c373e5e45b11ab22ae4
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,a)
a=mul(a,a)
e=max(0,e//2-1)
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[2]], 3], [[8]]), ([[[2]], 2], [[4]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 2], [[1]]), ([[[-1]], 3], [[-1]]), ([[[-1]], 4], [[1]])], [([[[2]], 4], [[16]]), ([[[2]], 5], [[32]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[2]], 5], [[32]]), ([[[2]], 8], [[256]]), ([[[-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]], 6], [[64]]), ([[[2]], 4], [[16]]), ([[[-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]], 7], [[128]]), ([[[2]], 7], [[128]]), ([[[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[2]] | [[8]] | Failed |
| explicit oracle 1 | [[1]] | [[4]] | Failed |
| explicit oracle 2 | [[1]] | [[1]] | Passed |
| explicit oracle 3 | [[-2, -12], [4, 6]] | [[1168, 2688], [-896, -624]] | Failed |
| 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 / 9637282a2c67c973309a71e9d0b5e790b2d6026acc7d1d87df2fd848f1b93cb7
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 = [[([[[2]], 3], [[8]]), ([[[2]], 2], [[4]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[-1]], 1], [[-1]]), ([[[-1]], 2], [[1]]), ([[[-1]], 3], [[-1]]), ([[[-1]], 4], [[1]])], [([[[2]], 4], [[16]]), ([[[2]], 5], [[32]]), ([[[-1]], 0], [[1]]), ([[[-1, 3], [-1, -3]], 8], [[1168, 2688], [-896, -624]]), ([[[2]], 8], [[256]]), ([[[2]], 0], [[1]]), ([[[2]], 1], [[2]]), ([[[2]], 2], [[4]])], [([[[2]], 5], [[32]]), ([[[2]], 8], [[256]]), ([[[-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]], 6], [[64]]), ([[[2]], 4], [[16]]), ([[[-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]], 7], [[128]]), ([[[2]], 7], [[128]]), ([[[-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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [[8]] | [[8]] | Passed |
| explicit oracle 1 | [[4]] | [[4]] | 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 / 6f411f2a851d08d2a2139a364420997e1f7b9be754f72917a0403691e219f88b
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.362735+00:00.
Case digest / 60ab629546ea7ebe8e938645b75c8cb19a908a29a4c9ff65f7e7cc4b89428287