FAILURE MAP
← Case archive

FA-6471 / Discrete calculus / Open access

Autocorrelation zero lag normalized · case 01

Sample count replaces zero-lag energy normalization.

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

ROOT CAUSE

Sample count replaces zero-lag energy normalization.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values))) if any(values) else None

Unsuccessful approach: Truncated-tail energy changes the normalization across lags.

Case contract

Integer sample values and compatible sample-array lengths. Rational results are reduced Fraction strings; spacing is positive unless explicitly stated otherwise. 0<=lag<=len(values); use the uncentered lagged product sum divided by full-signal energy. A zero-energy signal returns None. Exact operational definition: str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values))) if any(values) 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, lag):
    return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),len(values))) if values else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], 1)', solve(*([1, 2, 3], 1)), '4/7')
check('fixture 2: ([1, 2, 3], 0)', solve(*([1, 2, 3], 0)), '1')
check('fixture 3: ([2, 0], 1)', solve(*([2, 0], 1)), '0')
check('fixture 4: ([0, 0], 0)', solve(*([0, 0], 0)), 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, 2, 3], 1)8/34/7Failed
fixture 2: ([1, 2, 3], 0)14/31Failed
fixture 3: ([2, 0], 1)00Passed
fixture 4: ([0, 0], 0)0NoneFailed

SHA-256 / 29648dc96cacc26002b2429bea359c23773dbfa227137cb2665179153c6e0e82

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, lag):
    return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values[lag:]))) if any(values[lag:]) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], 1)', solve(*([1, 2, 3], 1)), '4/7')
check('fixture 2: ([1, 2, 3], 0)', solve(*([1, 2, 3], 0)), '1')
check('fixture 3: ([2, 0], 1)', solve(*([2, 0], 1)), '0')
check('fixture 4: ([0, 0], 0)', solve(*([0, 0], 0)), 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, 2, 3], 1)8/134/7Failed
fixture 2: ([1, 2, 3], 0)11Passed
fixture 3: ([2, 0], 1)None0Failed
fixture 4: ([0, 0], 0)NoneNonePassed

SHA-256 / fc18919c6065336e0606c21625abddcf073e60b278293a0e2ade05d470e3d2a3

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, lag):
    return str(Fraction(sum(a*b for a,b in zip(values,values[lag:])),sum(v*v for v in values))) if any(values) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], 1)', solve(*([1, 2, 3], 1)), '4/7')
check('fixture 2: ([1, 2, 3], 0)', solve(*([1, 2, 3], 0)), '1')
check('fixture 3: ([2, 0], 1)', solve(*([2, 0], 1)), '0')
check('fixture 4: ([0, 0], 0)', solve(*([0, 0], 0)), 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, 2, 3], 1)4/74/7Passed
fixture 2: ([1, 2, 3], 0)11Passed
fixture 3: ([2, 0], 1)00Passed
fixture 4: ([0, 0], 0)NoneNonePassed

SHA-256 / 010f1a0926edeb87553e2d0535e92d1d03ccb23e23b331868722b8623538a60c

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

Case digest / 4ea8b3be5bb2b3d1f4fcc7e75d128a5da427d12b6db1c187e78feb0bcf29e88b