FA-14136 / Numerical aggregation / Open access
Frequency cosine squared: Norms discard coordinates absent from the other sample. · case 01
The reduction disagrees with its explicit aggregation oracle.
ROOT CAUSE
Norms discard coordinates absent from the other sample.
VERIFIED REPAIR
Preserve the frequency cosine squared contract at the identified reduction decision.
Unsuccessful approach: Dropping exclusive mass from just one norm still overstates similarity.
Case contract
Treat samples as frequency vectors over nominal integer labels. Return squared cosine dot**2/(sum count_a**2 * sum count_b**2) as exact Fraction string. A zero norm on 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):
ca,cb=Counter(a),Counter(b)
keys=set(ca)|set(cb)
dot=sum(ca[k]*cb[k] for k in keys)
na=sum(ca[k]**2 for k in keys if cb[k])
nb=sum(cb[k]**2 for k in keys if ca[k])
return str(Fraction(dot*dot,na*nb)) if na and nb else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 1, 2], [1, 2, 2])), '16/25')
check('regression 2', solve(*([1, 2], [1, 2])), '1')
check('regression 3', solve(*([], [])), None)
check('regression 4', solve(*([0], [1])), '0')
check('regression 5', solve(*([1, 1, 1, 2], [1, 2])), '4/5')
check('regression 6', solve(*([-1, 0, 0], [0, 0, 1, 1])), '2/5')
check('regression 7', solve(*([2, 2], [])), None)
check("variable cosine concentration",solve([0]*N+[1],[0]),str(Fraction(N*N,N*N+1)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 16/25 | 16/25 | Passed |
| regression 2 | 1 | 1 | Passed |
| regression 3 | None | None | Passed |
| regression 4 | None | 0 | Failed |
| regression 5 | 4/5 | 4/5 | Passed |
| regression 6 | 1 | 2/5 | Failed |
| regression 7 | None | None | Passed |
| variable cosine concentration | 1 | 1/2 | Failed |
SHA-256 / bdb93abdd5dcfa0e3fee469d285e96ed0185358aa347c2d697d47a1282f782ae
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):
ca,cb=Counter(a),Counter(b)
keys=set(ca)|set(cb)
dot=sum(ca[k]*cb[k] for k in keys)
na=sum(ca[k]**2 for k in keys if cb[k])
nb=sum(v*v for v in cb.values())
return str(Fraction(dot*dot,na*nb)) if na and nb else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 1, 2], [1, 2, 2])), '16/25')
check('regression 2', solve(*([1, 2], [1, 2])), '1')
check('regression 3', solve(*([], [])), None)
check('regression 4', solve(*([0], [1])), '0')
check('regression 5', solve(*([1, 1, 1, 2], [1, 2])), '4/5')
check('regression 6', solve(*([-1, 0, 0], [0, 0, 1, 1])), '2/5')
check('regression 7', solve(*([2, 2], [])), None)
check("variable cosine concentration",solve([0]*N+[1],[0]),str(Fraction(N*N,N*N+1)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 16/25 | 16/25 | Passed |
| regression 2 | 1 | 1 | Passed |
| regression 3 | None | None | Passed |
| regression 4 | None | 0 | Failed |
| regression 5 | 4/5 | 4/5 | Passed |
| regression 6 | 1/2 | 2/5 | Failed |
| regression 7 | None | None | Passed |
| variable cosine concentration | 1 | 1/2 | Failed |
SHA-256 / 17554ab6061af811cab0330293e6c9fe900ee7e54ba177a901a8360eb4bd1ebf
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):
ca,cb=Counter(a),Counter(b)
keys=set(ca)|set(cb)
dot=sum(ca[k]*cb[k] for k in keys)
na=sum(v*v for v in ca.values())
nb=sum(v*v for v in cb.values())
return str(Fraction(dot*dot,na*nb)) if na and nb else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([1, 1, 2], [1, 2, 2])), '16/25')
check('regression 2', solve(*([1, 2], [1, 2])), '1')
check('regression 3', solve(*([], [])), None)
check('regression 4', solve(*([0], [1])), '0')
check('regression 5', solve(*([1, 1, 1, 2], [1, 2])), '4/5')
check('regression 6', solve(*([-1, 0, 0], [0, 0, 1, 1])), '2/5')
check('regression 7', solve(*([2, 2], [])), None)
check("variable cosine concentration",solve([0]*N+[1],[0]),str(Fraction(N*N,N*N+1)))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 16/25 | 16/25 | Passed |
| regression 2 | 1 | 1 | Passed |
| regression 3 | None | None | Passed |
| regression 4 | 0 | 0 | Passed |
| regression 5 | 4/5 | 4/5 | Passed |
| regression 6 | 2/5 | 2/5 | Passed |
| regression 7 | None | None | Passed |
| variable cosine concentration | 1/2 | 1/2 | Passed |
SHA-256 / 15037d025e834f16d75cb1853d682a3dbb64d80828dd074813a99eb78afcb9d1
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:13.849630+00:00.
Case digest / d7446da4d7cf15e599aca369973fce9203d114cc01317adeba9c83e3182fb3b4