FAILURE MAP
← Case archive

FA-13116 / Numerical aggregation / Open access

Frequency left quantile: Zero-frequency rows can satisfy the zero-percentile query. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Zero-frequency rows can satisfy the zero-percentile query.

THE FAILURE

Zero-frequency rows can satisfy the zero-percentile query.

Unsuccessful approach: Excluding zero-valued observations cannot remove zero-frequency support.

Case contract

Rows are integer [value, nonnegative frequency]; 0<=p<=q, q>0. Return the smallest supported value whose cumulative positive frequency reaches p/q of total. At p=0 return minimum positive support. No positive mass 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(rows, p, q):
    rows=sorted((x,w) for x,w in rows if w>=0)
    if not rows: return None
    total=sum(w for x,w in rows)
    threshold=Fraction(p,q)*total
    running=0
    for x,w in rows:
        running+=w
        if running>=threshold: return x
    return rows[-1][0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(-8, 1), (-2, 1), (3, 1)], 2, 5)), -2)
check('regression 2', solve(*([(1, 2), (8, 5)], 1, 2)), 8)
check('regression 3', solve(*([(1, 1), (8, 2)], 2, 5)), 8)
check('regression 4', solve(*([(9, 1), (1, 3), (5, 2)], 1, 2)), 1)
check('regression 5', solve(*([(8, 0), (2, 1)], 0, 1)), 2)
check('regression 6', solve(*([], 1, 2)), None)
check('regression 7', solve(*([(1, 0), (5, 0)], 1, 2)), None)
check('regression 8', solve(*([(1, 1), (4, 2), (8, 1)], 3, 4)), 4)
check('regression 9', solve(*([(9, 4), (2, 1)], 1, 1)), 9)
check('regression 10', solve(*([(3, 2), (3, 1), (1, 1)], 1, 2)), 3)
check('regression 11', solve(*([(2, 2), (7, 2)], 1, 2)), 2)
check("variable rank",solve([(N,2),(N+4,1)],1,2),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 1-2-2Passed
regression 288Passed
regression 388Passed
regression 411Passed
regression 522Passed
regression 6NoneNonePassed
regression 71NoneFailed
regression 844Passed
regression 999Passed
regression 1033Passed
regression 1122Passed
variable rank11Passed

SHA-256 / cb05f031531d8ba515cc89a3212099f805ed62a795de6f28c3cf32db8d245050

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(rows, p, q):
    rows=sorted((x,w) for x,w in rows if w>=0 and x!=0)
    if not rows: return None
    total=sum(w for x,w in rows)
    threshold=Fraction(p,q)*total
    running=0
    for x,w in rows:
        running+=w
        if running>=threshold: return x
    return rows[-1][0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([(-8, 1), (-2, 1), (3, 1)], 2, 5)), -2)
check('regression 2', solve(*([(1, 2), (8, 5)], 1, 2)), 8)
check('regression 3', solve(*([(1, 1), (8, 2)], 2, 5)), 8)
check('regression 4', solve(*([(9, 1), (1, 3), (5, 2)], 1, 2)), 1)
check('regression 5', solve(*([(8, 0), (2, 1)], 0, 1)), 2)
check('regression 6', solve(*([], 1, 2)), None)
check('regression 7', solve(*([(1, 0), (5, 0)], 1, 2)), None)
check('regression 8', solve(*([(1, 1), (4, 2), (8, 1)], 3, 4)), 4)
check('regression 9', solve(*([(9, 4), (2, 1)], 1, 1)), 9)
check('regression 10', solve(*([(3, 2), (3, 1), (1, 1)], 1, 2)), 3)
check('regression 11', solve(*([(2, 2), (7, 2)], 1, 2)), 2)
check("variable rank",solve([(N,2),(N+4,1)],1,2),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 1-2-2Passed
regression 288Passed
regression 388Passed
regression 411Passed
regression 522Passed
regression 6NoneNonePassed
regression 71NoneFailed
regression 844Passed
regression 999Passed
regression 1033Passed
regression 1122Passed
variable rank11Passed

SHA-256 / fe2ecebf0add3724473d67d4c7e43b1c6c5a92fe2431d5580174ed7b95b5b2f9

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 12 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / d49f725fafa440caecf08742b54b3326b93e0979f0032116f5e2910e4a3aaf1b