FAILURE MAP
← Case archive

FA-13486 / Numerical aggregation / Open access

Retractable central summary: The retraction correction squares the residual about the old center. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

The retraction correction squares the residual about the old center.

VERIFIED REPAIR

Preserve the retractable central summary contract at the identified reduction decision.

Unsuccessful approach: The new-center residual alone also lacks the translation cross product.

Case contract

Process add/remove integer observations; each removal names one active equal-valued observation. Maintain [count, exact mean, unnormalised squared central scatter]. Empty state is [0,"0","0"].

Why this case matters

Exact bounded examples isolate a reduction defect without floating-point or external-service effects.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)**2
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
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
regression 1[1, '8', '121/4'][1, '8', '0']Failed
regression 2[0, '0', '0'][0, '0', '0']Passed
regression 3[2, '9/2', '221/9'][2, '9/2', '49/2']Failed
regression 4[1, '9', '0'][1, '9', '0']Passed
regression 5[0, '0', '0'][0, '0', '0']Passed
regression 6[1, '2', '0'][1, '2', '0']Passed
regression 7[2, '3/2', '28'][2, '3/2', '25/2']Failed
regression 8[2, '11/2', '25/2'][2, '11/2', '25/2']Passed
regression 9[2, '15/2', '125/9'][2, '15/2', '9/2']Failed
variable removal[2, '3/2', '41/9'][2, '3/2', '9/2']Failed

SHA-256 / 17d439a6862c4d78f580e1fa626567887374254f1a22957de2f195c05d1adc1f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-new_mean)**2
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
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
regression 1[1, '8', '-121/2'][1, '8', '0']Failed
regression 2[0, '0', '0'][0, '0', '0']Passed
regression 3[2, '9/2', '293/12'][2, '9/2', '49/2']Failed
regression 4[1, '9', '0'][1, '9', '0']Passed
regression 5[0, '0', '0'][0, '0', '0']Passed
regression 6[1, '2', '0'][1, '2', '0']Passed
regression 7[2, '3/2', '-41/4'][2, '3/2', '25/2']Failed
regression 8[2, '11/2', '25/2'][2, '11/2', '25/2']Passed
regression 9[2, '15/2', '-115/12'][2, '15/2', '9/2']Failed
variable removal[2, '3/2', '53/12'][2, '3/2', '9/2']Failed

SHA-256 / 878ff7fe3168938425985271800116c5a69185936035865c64c826485d971a9a

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(events):
    n=0
    mean=m2=Fraction(0)
    for op,x in events:
        if op=="add":
            new_n=n+1
            delta=x-mean
            new_mean=mean+delta/new_n
            m2+=delta*(x-new_mean)
            mean=new_mean
            n=new_n
        else:
            new_n=n-1
            if new_n==0:
                n=0
                mean=m2=Fraction(0)
                continue
            new_mean=(n*mean-x)/new_n
            m2-=(x-mean)*(x-new_mean)
            mean=new_mean
            n=new_n
    return [n,str(mean),str(m2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('add', -3), ('add', 8), ('remove', -3)],)), [1, '8', '0'])
check('regression 2', solve(*([('add', 6), ('remove', 6)],)), [0, '0', '0'])
check('regression 3', solve(*([('add', 1), ('add', 4), ('add', 8), ('remove', 4)],)), [2, '9/2', '49/2'])
check('regression 4', solve(*([('add', -5), ('remove', -5), ('add', 9)],)), [1, '9', '0'])
check('regression 5', solve(*([],)), [0, '0', '0'])
check('regression 6', solve(*([('add', 2), ('add', 2), ('remove', 2)],)), [1, '2', '0'])
check('regression 7', solve(*([('add', 0), ('add', 4), ('add', 9), ('add', -1), ('remove', 0), ('remove', 9)],)), [2, '3/2', '25/2'])
check('regression 8', solve(*([('add', 3), ('add', 8)],)), [2, '11/2', '25/2'])
check('regression 9', solve(*([('add', 1), ('add', 6), ('add', 9), ('remove', 1)],)), [2, '15/2', '9/2'])
check("variable removal",solve([("add",0),("add",N),("add",3*N),("remove",N)]),[2,str(Fraction(3*N,2)),str(Fraction(9*N*N,2))])
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
regression 1[1, '8', '0'][1, '8', '0']Passed
regression 2[0, '0', '0'][0, '0', '0']Passed
regression 3[2, '9/2', '49/2'][2, '9/2', '49/2']Passed
regression 4[1, '9', '0'][1, '9', '0']Passed
regression 5[0, '0', '0'][0, '0', '0']Passed
regression 6[1, '2', '0'][1, '2', '0']Passed
regression 7[2, '3/2', '25/2'][2, '3/2', '25/2']Passed
regression 8[2, '11/2', '25/2'][2, '11/2', '25/2']Passed
regression 9[2, '15/2', '9/2'][2, '15/2', '9/2']Passed
variable removal[2, '3/2', '9/2'][2, '3/2', '9/2']Passed

SHA-256 / 934603062c82331399a360a442923d58c38e14789ee6f7fbc7fe7e8ec85b9813

Verification & scope

Small offline integer/rational inputs only; no performance, statistical inference, or production-library conformance claim. 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:07.486583+00:00.

Case digest / d554c9ee96229676df24a1c7e63ca6f971194a08b560d522c2d470d11e989491