FAILURE MAP
← Case archive

FA-6406 / Discrete calculus / Open access

Linear extrapolation last slope · case 01

Last-value persistence discards the final slope.

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

ROOT CAUSE

Last-value persistence discards the final slope.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return 2*values[-1]-values[-2] if len(values)>1 else None

Unsuccessful approach: The previous value is added instead of subtracting it in the slope.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. Linear extrapolation last slope. Exact operational definition: 2*values[-1]-values[-2] if len(values)>1 else None

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 values[-1] if values else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3, 5],)', solve(*([1, 3, 5],)), 7)
check('fixture 2: ([5, 3, 1],)', solve(*([5, 3, 1],)), -1)
check('fixture 3: ([4, 4],)', solve(*([4, 4],)), 4)
check('fixture 4: ([2],)', solve(*([2],)), None)
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, 3, 5],)57Failed
fixture 2: ([5, 3, 1],)1-1Failed
fixture 3: ([4, 4],)44Passed
fixture 4: ([2],)2NoneFailed

SHA-256 / 708a68f0201c1bbd04a21d128cef75efd12ff054caaefc728f3745b7118072a9

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 values[-1]+values[-2] if len(values)>1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3, 5],)', solve(*([1, 3, 5],)), 7)
check('fixture 2: ([5, 3, 1],)', solve(*([5, 3, 1],)), -1)
check('fixture 3: ([4, 4],)', solve(*([4, 4],)), 4)
check('fixture 4: ([2],)', solve(*([2],)), None)
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, 3, 5],)87Failed
fixture 2: ([5, 3, 1],)4-1Failed
fixture 3: ([4, 4],)84Failed
fixture 4: ([2],)NoneNonePassed

SHA-256 / 8fe621d742f6c31e1daf21f4f75d3530ccfe134a7bcf05f27cdd36c4f6ee85e4

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 2*values[-1]-values[-2] if len(values)>1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3, 5],)', solve(*([1, 3, 5],)), 7)
check('fixture 2: ([5, 3, 1],)', solve(*([5, 3, 1],)), -1)
check('fixture 3: ([4, 4],)', solve(*([4, 4],)), 4)
check('fixture 4: ([2],)', solve(*([2],)), None)
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, 3, 5],)77Passed
fixture 2: ([5, 3, 1],)-1-1Passed
fixture 3: ([4, 4],)44Passed
fixture 4: ([2],)NoneNonePassed

SHA-256 / d837faae0800ae829ba5156783e2a13233a79a417f6318f93614b4d2e1c60309

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

Case digest / 436fa1a3dc01e3ae674c902d37904a86141cbff07e5f97b33820d6161693bf73