FA-14816 / Numerics / Open access
Polynomial squarefree characteristic p: formal derivative in finite characteristic · case 01
The exact polynomial squarefree characteristic p result violates the stated contract at formal derivative in finite characteristic.
ROOT CAUSE
The formal derivative in finite characteristic step uses [f[i]%p for i in range(1,len(f))] instead of [(i*f[i])%p for i in range(1,len(f))].
VERIFIED REPAIR
Use [(i*f[i])%p for i in range(1,len(f))] at the formal derivative in finite characteristic step.
Unsuccessful approach: The partial repair [(i*f[i]) for i in range(1,len(f))] still violates the formal derivative in finite characteristic invariant.
Case contract
Input [coefficients,p] prime p; return whether nonconstant polynomial over Fp has gcd(f,fprime)=1; constants false. Bounds: degree at most three and prime p<=7.
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,p=x
f=[v%p for v in a]
while f and f[-1]==0:f.pop()
if len(f)<2:return False
g=[f[i]%p for i in range(1,len(f))]
while g and g[-1]==0:g.pop()
for _ in range(20):
if not g:break
r=f[:]
for _ in range(20):
if len(r)<len(g):break
if g[-1]%p==0:return None
c=r[-1]*pow(g[-1],-1,p)%p
k=len(r)-len(g)
for j in range(len(g)):r[j+k]=(r[j+k]-c*g[j])%p
while r and r[-1]==0:r.pop()
f,g=g,r
return len(f)==1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 1, 1], 2], True), ([[0, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 2], 2], False), ([[1, 1], 2], True), ([[1, 2], 2], False), ([[2, 1], 2], True)], [([[1, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 2, 2], 2], False), ([[2, 0, 1], 2], False), ([[2, 0, 2], 2], False), ([[2, 1, 1], 2], True), ([[2, 1, 2], 2], True)], [([[1, 2, 1], 2], False), ([[2, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 1, 2, 1], 2], False), ([[0, 1, 2, 2], 2], True), ([[0, 2, 0, 1], 2], False), ([[0, 2, 0, 2], 2], False)], [([[2, 1, 1], 2], True), ([[0, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 1, 1, 2], 2], True), ([[1, 1, 2, 1], 2], True), ([[1, 1, 2, 2], 2], True), ([[1, 2, 0, 1], 2], True)], [([[0, 1, 1, 1], 2], True), ([[1, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[2, 1, 1, 1], 2], True), ([[2, 1, 1, 2], 2], True), ([[2, 1, 2, 1], 2], False), ([[2, 1, 2, 2], 2], True)]]
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 | False | True | Failed |
| explicit oracle 1 | False | False | Passed |
| explicit oracle 2 | True | True | Passed |
| explicit oracle 3 | True | True | Passed |
| explicit oracle 4 | False | False | Passed |
| explicit oracle 5 | True | True | Passed |
| explicit oracle 6 | False | False | Passed |
| explicit oracle 7 | True | True | Passed |
SHA-256 / 7f4a15051ea987bfd043c1634eac59a4909f84548c9ddeadba54c1a3ac9af86c
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,p=x
f=[v%p for v in a]
while f and f[-1]==0:f.pop()
if len(f)<2:return False
g=[(i*f[i]) for i in range(1,len(f))]
while g and g[-1]==0:g.pop()
for _ in range(20):
if not g:break
r=f[:]
for _ in range(20):
if len(r)<len(g):break
if g[-1]%p==0:return None
c=r[-1]*pow(g[-1],-1,p)%p
k=len(r)-len(g)
for j in range(len(g)):r[j+k]=(r[j+k]-c*g[j])%p
while r and r[-1]==0:r.pop()
f,g=g,r
return len(f)==1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 1, 1], 2], True), ([[0, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 2], 2], False), ([[1, 1], 2], True), ([[1, 2], 2], False), ([[2, 1], 2], True)], [([[1, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 2, 2], 2], False), ([[2, 0, 1], 2], False), ([[2, 0, 2], 2], False), ([[2, 1, 1], 2], True), ([[2, 1, 2], 2], True)], [([[1, 2, 1], 2], False), ([[2, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 1, 2, 1], 2], False), ([[0, 1, 2, 2], 2], True), ([[0, 2, 0, 1], 2], False), ([[0, 2, 0, 2], 2], False)], [([[2, 1, 1], 2], True), ([[0, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 1, 1, 2], 2], True), ([[1, 1, 2, 1], 2], True), ([[1, 1, 2, 2], 2], True), ([[1, 2, 0, 1], 2], True)], [([[0, 1, 1, 1], 2], True), ([[1, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[2, 1, 1, 1], 2], True), ([[2, 1, 1, 2], 2], True), ([[2, 1, 2, 1], 2], False), ([[2, 1, 2, 2], 2], True)]]
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 | None | True | Failed |
| explicit oracle 1 | None | False | Failed |
| explicit oracle 2 | True | True | Passed |
| explicit oracle 3 | True | True | Passed |
| explicit oracle 4 | False | False | Passed |
| explicit oracle 5 | True | True | Passed |
| explicit oracle 6 | False | False | Passed |
| explicit oracle 7 | True | True | Passed |
SHA-256 / 9a86c6e574a393ebc4678bce900119791620582c14310fadb44ec2517bf625e2
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,p=x
f=[v%p for v in a]
while f and f[-1]==0:f.pop()
if len(f)<2:return False
g=[(i*f[i])%p for i in range(1,len(f))]
while g and g[-1]==0:g.pop()
for _ in range(20):
if not g:break
r=f[:]
for _ in range(20):
if len(r)<len(g):break
if g[-1]%p==0:return None
c=r[-1]*pow(g[-1],-1,p)%p
k=len(r)-len(g)
for j in range(len(g)):r[j+k]=(r[j+k]-c*g[j])%p
while r and r[-1]==0:r.pop()
f,g=g,r
return len(f)==1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 1, 1], 2], True), ([[0, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 2], 2], False), ([[1, 1], 2], True), ([[1, 2], 2], False), ([[2, 1], 2], True)], [([[1, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 2, 2], 2], False), ([[2, 0, 1], 2], False), ([[2, 0, 2], 2], False), ([[2, 1, 1], 2], True), ([[2, 1, 2], 2], True)], [([[1, 2, 1], 2], False), ([[2, 0, 1], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[0, 1, 2, 1], 2], False), ([[0, 1, 2, 2], 2], True), ([[0, 2, 0, 1], 2], False), ([[0, 2, 0, 2], 2], False)], [([[2, 1, 1], 2], True), ([[0, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[1, 1, 1, 2], 2], True), ([[1, 1, 2, 1], 2], True), ([[1, 1, 2, 2], 2], True), ([[1, 2, 0, 1], 2], True)], [([[0, 1, 1, 1], 2], True), ([[1, 0, 1, 2], 2], False), ([[0, 1], 2], True), ([[2, 2, 2, 2], 7], True), ([[2, 1, 1, 1], 2], True), ([[2, 1, 1, 2], 2], True), ([[2, 1, 2, 1], 2], False), ([[2, 1, 2, 2], 2], True)]]
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 | True | True | Passed |
| explicit oracle 1 | False | False | Passed |
| explicit oracle 2 | True | True | Passed |
| explicit oracle 3 | True | True | Passed |
| explicit oracle 4 | False | False | Passed |
| explicit oracle 5 | True | True | Passed |
| explicit oracle 6 | False | False | Passed |
| explicit oracle 7 | True | True | Passed |
SHA-256 / cae5f93268cb19815f5e08153a7d8a7e9ea75907dbc3b283b9edb48bd8ec05c8
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:20.553560+00:00.
Case digest / 99320fedc445ec8e2b23b7f1c33244d8be03ba8907adfdd309211e86c65201f3