FA-6236 / Statistics / Open access
Population covariance rational · case 01
The cross moment is not centered by both means.
ROOT CAUSE
The cross moment is not centered by both means.
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(x,y)),len(x))-Fraction(sum(x)*sum(y),len(x)**2)) if x else None
Unsuccessful approach: Sample normalization replaces the specified population covariance.
Case contract
Integer finite observations and equal lengths for paired samples. Counts and weights are nonnegative. Rational results use reduced Fraction strings. Empty or undefined statistics return None where shown. Population covariance rational. Exact operational definition: str(Fraction(sum(a*b for a,b in zip(x,y)),len(x))-Fraction(sum(x)*sum(y),len(x)**2)) if x else None
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Statistical estimators 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(x, y):
return str(Fraction(sum(a*b for a,b in zip(x,y)),len(x))) if x else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [2, 4, 6])', solve(*([1, 2, 3], [2, 4, 6])), '4/3')
check('fixture 2: ([2, 2], [1, 3])', solve(*([2, 2], [1, 3])), '0')
check('fixture 3: ([1, 2], [2, 1])', solve(*([1, 2], [2, 1])), '-1/4')
check('fixture 4: ([], [])', solve(*([], [])), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3], [2, 4, 6]) | 28/3 | 4/3 | Failed |
| fixture 2: ([2, 2], [1, 3]) | 4 | 0 | Failed |
| fixture 3: ([1, 2], [2, 1]) | 2 | -1/4 | Failed |
| fixture 4: ([], []) | None | None | Passed |
SHA-256 / 88dc04795ba9a917bd03161021e24833b5c151b07f7e357fb00f9bf30c6738fb
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(x, y):
return str((Fraction(sum(a*b for a,b in zip(x,y)),len(x))-Fraction(sum(x)*sum(y),len(x)**2))*len(x)/(len(x)-1)) if len(x)>1 else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [2, 4, 6])', solve(*([1, 2, 3], [2, 4, 6])), '4/3')
check('fixture 2: ([2, 2], [1, 3])', solve(*([2, 2], [1, 3])), '0')
check('fixture 3: ([1, 2], [2, 1])', solve(*([1, 2], [2, 1])), '-1/4')
check('fixture 4: ([], [])', solve(*([], [])), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3], [2, 4, 6]) | 2 | 4/3 | Failed |
| fixture 2: ([2, 2], [1, 3]) | 0 | 0 | Passed |
| fixture 3: ([1, 2], [2, 1]) | -1/2 | -1/4 | Failed |
| fixture 4: ([], []) | None | None | Passed |
SHA-256 / 65ea1ccf6143018f213ce9055a7e1c7f65ed33df15f21307a5cd5a284de51b3a
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(x, y):
return str(Fraction(sum(a*b for a,b in zip(x,y)),len(x))-Fraction(sum(x)*sum(y),len(x)**2)) if x else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [2, 4, 6])', solve(*([1, 2, 3], [2, 4, 6])), '4/3')
check('fixture 2: ([2, 2], [1, 3])', solve(*([2, 2], [1, 3])), '0')
check('fixture 3: ([1, 2], [2, 1])', solve(*([1, 2], [2, 1])), '-1/4')
check('fixture 4: ([], [])', solve(*([], [])), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3], [2, 4, 6]) | 4/3 | 4/3 | Passed |
| fixture 2: ([2, 2], [1, 3]) | 0 | 0 | Passed |
| fixture 3: ([1, 2], [2, 1]) | -1/4 | -1/4 | Passed |
| fixture 4: ([], []) | None | None | Passed |
SHA-256 / c386711f688264669b3c5ab5f304e1eb3b82bb380611c4a8a4eab44cac6753a6
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:37:59.191706+00:00.
Case digest / 185765a5f2d368ff02ff1bf6d62a4d0b94429876041d747abf3a0f9f7e0eed0e