FAILURE MAP
← Case archive

FA-13421 / Numerical aggregation / Open access

Empirical transport distance: The CDF discrepancy is summed without interval width. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

The CDF discrepancy is summed without interval width.

VERIFIED REPAIR

Preserve the empirical transport distance contract at the identified reduction decision.

Unsuccessful approach: Measuring every width from the origin overcounts later intervals.

Case contract

For nonempty integer samples with equal total probability after separate normalization, return integral of absolute CDF difference over the real line as a Fraction string. Empty either side returns None.

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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)
    return str(area)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
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 17/617/6Failed
regression 215Failed
regression 300Passed
regression 4NoneNonePassed
regression 54/320/3Failed
regression 61/34/3Failed
regression 714Failed
variable transport span11Passed

SHA-256 / e59c87aa1a67b44a8b189186c5c17b09ab89910d2d264017ec955a4a8d95e5f5

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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*(points[i+1]-points[0])
    return str(area)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
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 113/317/6Failed
regression 255Passed
regression 300Passed
regression 4NoneNonePassed
regression 51720/3Failed
regression 65/34/3Failed
regression 774Failed
variable transport span11Passed

SHA-256 / e9baa906cb594e000aea68360b73511dee860f50d9776f2a03b3c033d8cca804

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(a, b):
    if not a or not b: return None
    ca,cb=Counter(a),Counter(b)
    points=sorted(set(ca)|set(cb))
    pa=pb=Fraction(0)
    area=Fraction(0)
    for i,x in enumerate(points[:-1]):
        pa+=Fraction(ca[x],len(a))
        pb+=Fraction(cb[x],len(b))
        area+=abs(pa-pb)*(points[i+1]-x)
    return str(area)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 9], [1, 4])), '17/6')
check('regression 2', solve(*([2], [7])), '5')
check('regression 3', solve(*([1, 2], [1, 2])), '0')
check('regression 4', solve(*([], [1])), None)
check('regression 5', solve(*([-8, -1, 4], [-3, 9, 9])), '20/3')
check('regression 6', solve(*([0, 2, 8], [0, 8])), '4/3')
check('regression 7', solve(*([0, 10], [4, 6])), '4')
check("variable transport span",solve([0],[N]),str(N))
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 117/617/6Passed
regression 255Passed
regression 300Passed
regression 4NoneNonePassed
regression 520/320/3Passed
regression 64/34/3Passed
regression 744Passed
variable transport span11Passed

SHA-256 / aedf34f7a9c69f0b5617f3aefe986b52030289190148a5521303189b768a7b17

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

Case digest / 3af034be3e955dd65533c57d44a9a898ee7ce2ad46a4e087924cce99a561784c