FAILURE MAP
← Case archive

FA-6351 / Discrete calculus / Open access

Forward first difference · case 01

Subtraction order reverses the discrete derivative.

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

ROOT CAUSE

Subtraction order reverses the discrete derivative.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [b-a for a,b in zip(values,values[1:])]

Unsuccessful approach: Adding neighbors replaces their change.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Forward first difference. Exact operational definition: [b-a for a,b in zip(values,values[1:])]

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Discrete calculus 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(values):
    return [a-b for a,b in zip(values,values[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 4, 9, 16],)', solve(*([1, 4, 9, 16],)), [3, 5, 7])
check('fixture 2: ([3, 3],)', solve(*([3, 3],)), [0])
check('fixture 3: ([7],)', solve(*([7],)), [])
check('fixture 4: ([],)', solve(*([],)), [])
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, 4, 9, 16],)[-3, -5, -7][3, 5, 7]Failed
fixture 2: ([3, 3],)[0][0]Passed
fixture 3: ([7],)[][]Passed
fixture 4: ([],)[][]Passed

SHA-256 / 04b50af72b87793d2889e950996679e25cddeac85f14f3a11cfd2757070a6fee

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(values):
    return [b+a for a,b in zip(values,values[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 4, 9, 16],)', solve(*([1, 4, 9, 16],)), [3, 5, 7])
check('fixture 2: ([3, 3],)', solve(*([3, 3],)), [0])
check('fixture 3: ([7],)', solve(*([7],)), [])
check('fixture 4: ([],)', solve(*([],)), [])
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, 4, 9, 16],)[5, 13, 25][3, 5, 7]Failed
fixture 2: ([3, 3],)[6][0]Failed
fixture 3: ([7],)[][]Passed
fixture 4: ([],)[][]Passed

SHA-256 / ad8d7321a35ac110e982b63b41c5d0405838af0b1e1bd26494d7d96ca8d5df4d

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(values):
    return [b-a for a,b in zip(values,values[1:])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 4, 9, 16],)', solve(*([1, 4, 9, 16],)), [3, 5, 7])
check('fixture 2: ([3, 3],)', solve(*([3, 3],)), [0])
check('fixture 3: ([7],)', solve(*([7],)), [])
check('fixture 4: ([],)', solve(*([],)), [])
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, 4, 9, 16],)[3, 5, 7][3, 5, 7]Passed
fixture 2: ([3, 3],)[0][0]Passed
fixture 3: ([7],)[][]Passed
fixture 4: ([],)[][]Passed

SHA-256 / 4304bf57694df2b762c1346b63cecb1403206c5fe43726fadc3cfd4ee923d796

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

Case digest / 9e8226a828df940037abc71624d8bfccb031d54996eca5cb646821a41941c73f